Core
3.2
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
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
* @package FDL
6
*/
7
/**
8
* detect post migration script
9
*
10
* @author Anakeen
11
* @version $Id: $
12
* @package FDL
13
*/
14
$WIFF_ROOT
= getenv(
"WIFF_ROOT"
);
15
if
(
$WIFF_ROOT
===
false
) {
16
print
"WIFF_ROOT environment variable is not set!\n"
;
17
exit
(1);
18
}
19
20
$WIFF_CONTEXT_ROOT
= getenv(
"WIFF_CONTEXT_ROOT"
);
21
if
(
$WIFF_CONTEXT_ROOT
===
false
) {
22
print
"WIFF_CONTEXT_ROOT environment variable not set!\n"
;
23
exit
(1);
24
}
25
26
set_include_path(get_include_path() . PATH_SEPARATOR .
$WIFF_CONTEXT_ROOT
. PATH_SEPARATOR .
"$WIFF_ROOT/include"
);
27
28
$prefix
=
$WIFF_CONTEXT_ROOT
.
"/WHAT/Lib.Prefix.php"
;
29
if
(!include (
$prefix
)) {
30
print
"cannot include file $prefix"
;
31
exit
(1);
32
}
33
34
include (
"WHAT/Lib.Common.php"
);
35
include (
"WHAT/Lib.WCheck.php"
);
36
37
if
($argc != 2) {
38
printf(
"program %s need application parameter\n"
, $argv[0]);
39
exit
(1);
40
}
41
$appname
= $argv[1];
42
43
$err
=
getCheckApp
(
$pubdir
, $tapp,
true
);
44
if
(
$err
) {
45
print
$err
;
46
exit
(1);
47
}
48
49
$app
= $tapp[
$appname
];
50
if
(!
$app
) {
51
printf(
"application %s not found\n"
, $argv[1]);
52
exit
(1);
53
}
54
55
require (
'lib/Lib.Cli.php'
);
56
57
$PGSERVICE_CORE
= wiff_getParamValue(
'core_db'
);
58
$FREEDOM_CONTEXT
=
'default'
;
59
60
putenv(sprintf(
"wpub=%s"
,
$WIFF_CONTEXT_ROOT
));
61
putenv(sprintf(
"pgservice_core=%s"
,
$PGSERVICE_CORE
));
62
putenv(sprintf(
"pgservice_freedom=%s"
,
$PGSERVICE_CORE
));
63
putenv(sprintf(
"freedom_context=%s"
,
$FREEDOM_CONTEXT
));
64
65
$err
=
getCheckActions
(
$pubdir
, array(
66
$appname
=>
$app
67
) , $actions,
true
);
68
69
$appname_RE
= preg_quote(
$appname
,
'@'
);
70
$postmigr
= array_filter($actions,
function
($x) use (
$appname_RE
)
71
{
72
return
preg_match(
"@/${appname_RE}_(p|post)migr@"
, $x);
73
});
74
75
foreach
(
$postmigr
as
$cmd
) {
76
error_log(sprintf(
"Executing [%s]..."
, $cmd));
77
exec($cmd,
$out
,
$ret
);
78
print
implode(
"\n"
,
$out
);
79
if
(
$ret
!= 0) {
80
error_log(sprintf(
"Failed!"
));
81
exit
(
$ret
);
82
}
83
error_log(sprintf(
"Done."
));
84
}
85
?>
$app
if($err) $app
Definition:
post_migration.php:49
$pubdir
global $pubdir
Definition:
vault_init.php:18
getCheckActions
getCheckActions($pubdir, $tapp, &$tact, $usePreviousVersion=false)
Definition:
Lib.WCheck.php:198
$PGSERVICE_CORE
$PGSERVICE_CORE
Definition:
post_migration.php:57
$ret
$ret
Definition:
fdl_export1nf.php:91
$err
$err
Definition:
post_migration.php:43
$appname
if($argc!=2) $appname
Definition:
post_migration.php:41
$out
$out
Definition:
Api/freedom_import.php:37
$cmd
foreach($argv as $arg) $cmd
Definition:
Api/freedom_import.php:35
$postmigr
$postmigr
Definition:
post_migration.php:70
print
print
Definition:
checklist.php:49
exit
switch($command) exit
Definition:
checkVault.php:46
$FREEDOM_CONTEXT
$FREEDOM_CONTEXT
Definition:
post_migration.php:58
$WIFF_CONTEXT_ROOT
if($WIFF_ROOT===false) $WIFF_CONTEXT_ROOT
Definition:
post_migration.php:20
getCheckApp
getCheckApp($pubdir, &$tapp, $usePreviousVersion=false)
Definition:
Lib.WCheck.php:146
$WIFF_ROOT
$WIFF_ROOT
Definition:
post_migration.php:14
$prefix
$prefix
Definition:
post_migration.php:28
$appname_RE
$appname_RE
Definition:
post_migration.php:69
← centre documentaire
© anakeen