Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
post_migration.php
Go to the documentation of this file.
1
#!/usr/bin/env php
2
<?php
3
/*
4
* @author Anakeen
5
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
6
* @package FDL
7
*/
8
/**
9
* detect post migration script
10
*
11
* @author Anakeen 2009
12
* @version $Id: $
13
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
14
* @package FDL
15
*/
16
$WIFF_ROOT
= getenv(
"WIFF_ROOT"
);
17
if
(
$WIFF_ROOT
===
false
) {
18
print
"WIFF_ROOT environment variable is not set!\n"
;
19
exit
(1);
20
}
21
22
$WIFF_CONTEXT_ROOT
= getenv(
"WIFF_CONTEXT_ROOT"
);
23
if
(
$WIFF_CONTEXT_ROOT
===
false
) {
24
print
"WIFF_CONTEXT_ROOT environment variable not set!\n"
;
25
exit
(1);
26
}
27
28
set_include_path(get_include_path() . PATH_SEPARATOR .
$WIFF_CONTEXT_ROOT
. PATH_SEPARATOR .
"$WIFF_ROOT/include"
);
29
30
$prefix
=
$WIFF_CONTEXT_ROOT
.
"/WHAT/Lib.Prefix.php"
;
31
if
(!include (
$prefix
)) {
32
print
"cannot include file $prefix"
;
33
exit
(1);
34
}
35
36
include (
"WHAT/Lib.Common.php"
);
37
include (
"WHAT/Lib.WCheck.php"
);
38
39
if
($argc != 2) {
40
printf(
"program %s need application parameter\n"
, $argv[0]);
41
exit
(1);
42
}
43
$appname
= $argv[1];
44
45
$version_override
= array();
46
$MODULE_VERSION_FROM
= getenv(
'MODULE_VERSION_FROM'
);
47
if
(
$MODULE_VERSION_FROM
!==
false
) {
48
$version_override
[
$appname
] =
$MODULE_VERSION_FROM
;
49
}
50
51
$err
=
getCheckApp
(
$pubdir
, $tapp,
$version_override
);
52
if
(
$err
) {
53
print
$err
;
54
exit
(1);
55
}
56
57
$app
= $tapp[
$appname
];
58
if
(!
$app
) {
59
printf(
"application %s not found\n"
, $argv[1]);
60
exit
(1);
61
}
62
63
require (
'lib/Lib.Cli.php'
);
64
65
$HTTPUSER
= wiff_getParamValue(
'apacheuser'
);
66
$PGSERVICE_CORE
= wiff_getParamValue(
'core_db'
);
67
$FREEDOM_CONTEXT
=
'default'
;
68
69
putenv(sprintf(
"wpub=%s"
,
$WIFF_CONTEXT_ROOT
));
70
putenv(sprintf(
"httpuser=%s"
,
$HTTPUSER
));
71
putenv(sprintf(
"pgservice_core=%s"
,
$PGSERVICE_CORE
));
72
putenv(sprintf(
"pgservice_freedom=%s"
,
$PGSERVICE_CORE
));
73
putenv(sprintf(
"freedom_context=%s"
,
$FREEDOM_CONTEXT
));
74
75
$err
=
getCheckActions
(
$pubdir
, array(
76
$appname
=>
$app
77
) , $actions,
$version_override
);
78
79
$postmigr
= array_filter($actions, create_function(
'$x'
,
"return preg_match('@/\\Q$appname\\E_(p|post)migr@', \$x);"
));
80
81
foreach
(
$postmigr
as
$cmd
) {
82
error_log(sprintf(
"Executing [%s]..."
, $cmd));
83
exec($cmd,
$out
,
$ret
);
84
print implode(
"\n"
,
$out
);
85
if
(
$ret
!= 0) {
86
error_log(sprintf(
"Failed!"
));
87
exit
(
$ret
);
88
}
89
error_log(sprintf(
"Done."
));
90
}
91
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase