-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathez-dependencies.php
45 lines (38 loc) · 1.16 KB
/
ez-dependencies.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
echo "Checking folder for required dependencies.\n";
$vendor = getcwd() . "/vendor";
$legacy = getcwd() . "/ezpublish_legacy";
if (is_dir($vendor) && is_dir($legacy))
{
echo "All dependencies in place. Nothing to do.";
exit(0);
}
$pathToEz = isset($argv[1]) ? $argv[1] : null;
if (!is_dir($pathToEz) && !is_link($pathToEz))
{
echo "Supply to ezpublish sources: ";
$handle = fopen ("php://stdin","r");
$pathToEz = trim(preg_replace("/[\r\n]/","",fgets($handle)));
if(!is_dir($pathToEz) && !is_link($pathToEz)){
echo "Path: $pathToEz does not exist.";
exit(1);
}
}
$pathToEzVendor = $pathToEz . "/vendor";
$pathToEzLegacy = $pathToEz . "/ezpublish_legacy";
if (file_exists($pathToEzVendor) && file_exists($pathToEzLegacy))
{
echo "Copy: $pathToEzVendor -> $vendor\n";
//copy($pathToEzVendor, $vendor);
exec("cp -r $pathToEzVendor $vendor");
echo "Copy: $pathToEzLegacy -> $legacy\n";
//copy($pathToEzLegacy, $legacy);
exec("cp -r $pathToEzLegacy $legacy");
exit(0);
}
else {
echo "Could not find sources for vendor and ezpublish_legacy.";
exit(1);
}
echo "\n";
echo "Thank you, continuing...\n";