forked from texnixe/yellowcms-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-test.php
executable file
·35 lines (34 loc) · 1.78 KB
/
make-test.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
<?php
// Datenstrom Yellow extensions, https://github.com/datenstrom/yellow-extensions
if (PHP_SAPI!="cli") {
die("ERROR making test environment: Please run at the command line!\n");
} else {
if (!is_dir("test")) {
echo "\rMaking test environment 0%... ";
mkdir("test/system/extensions", 0777, true);
copy("source/install/yellow.php", "test/yellow.php");
copy("source/core/core.php", "test/system/extensions/core.php");
copy("source/update/update.php", "test/system/extensions/update.php");
$directoryHandle = opendir("zip");
if ($directoryHandle) {
while (($entry = readdir($directoryHandle))!==false) {
if (substr($entry, 0, 1)==".") continue;
copy("zip/$entry", "test/system/extensions/$entry");
}
closedir($directoryHandle);
}
echo "\rMaking test environment 20%... ";
$fileData = date("Y-m-d H:i:s")." info Make test environment for Datenstrom Yellow extensions\n";
file_put_contents("test/system/extensions/yellow.log", $fileData);
$fileData = "# Datenstrom Yellow system settings\n\nSitename: Test\nCoreStaticUrl: http://website\n";
file_put_contents("test/system/extensions/yellow-system.ini", $fileData);
exec("cd test; php yellow.php update", $outputLines, $returnStatus);
if ($returnStatus!=0) {
foreach ($outputLines as $line) echo "$line\n";
exit($returnStatus);
}
file_put_contents("test/content/contact/page.md", "exclude\n"); //TODO: remove later, exclude contact page for now
file_put_contents("test/content/search/page.md", "exclude\n"); //TODO: remove later, exclude search page for now
echo "\rMaking test environment 100%... done\n";
}
}