-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.php
32 lines (31 loc) · 940 Bytes
/
setup.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
<?php
/**
* Run this script from the root directory of your WebEngine project.
* e.g. php vendor/phpgt/webengine/setup.php
*
* The purpose of this script is to make sure that the project is set up
* correctly, if it has been installed manually, rather than via the composer
* create-project command.
*/
$error = null;
if(!is_dir("vendor")) {
if(!is_file("composer.json")) {
$error = "The current directory is not a WebEngine project.";
}
$error = "No vendor directory found - do you need to run `composer install`?";
}
if(is_file("build.default.json")) {
$error = "Please run this script from your project's root directory.";
}
if($error) {
echo "$error See https://www.php.gt/webengine/setup for more information.", PHP_EOL;
exit(1);
}
$indexPhpContents = <<<PHP
<?php
require(__DIR__ . "/../vendor/phpgt/webengine/go.php");
PHP;
if(!is_dir("www")) {
mkdir("www");
}
file_put_contents("www/index.php", $indexPhpContents);