-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.php
51 lines (40 loc) · 1.07 KB
/
build.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
46
47
48
49
50
51
<?php
function is_cli()
{
if ( defined('STDIN') )
{
return true;
}
if ( php_sapi_name() === 'cli' )
{
return true;
}
if ( array_key_exists('SHELL', $_ENV) ) {
return true;
}
if ( empty($_SERVER['REMOTE_ADDR']) and !isset($_SERVER['HTTP_USER_AGENT']) and count($_SERVER['argv']) > 0)
{
return true;
}
if ( !array_key_exists('REQUEST_METHOD', $_SERVER) )
{
return true;
}
return false;
}
if(!is_cli()) {
exit(100);
}
$dir = getcwd();
if(is_null($dir) || !$dir) {
echo "Error, can't read the current working directory. Please make sure all permissions are set correctly. See http://php.net/manual/en/function.getcwd.php";
exit(1);
}
require_once 'src/Tschallacka/WPBuilder/Builder.php';
require_once 'src/Tschallacka/WPBuilder/Config.php';
require_once 'src/Tschallacka/WPBuilder/File.php';
use Tschallacka\WPBuilder\Config;
use Tschallacka\WPBuilder\Builder;
Config::$DIRECTORY = $dir;
$builder = new Builder($argv);
$builder->run();