diff options
author | Fbenas <philbeansburton@gmail.com> | 2017-08-20 04:18:13 +0100 |
---|---|---|
committer | Fbenas <philbeansburton@gmail.com> | 2017-08-20 04:18:13 +0100 |
commit | 0ed82a2c6ffd8e981d9dd388306379941ecb5720 (patch) | |
tree | 52c7d66149a93c7d4d8038d356bb0107bad09766 /scripts | |
parent | 048634fd8a65d37f21bcb3a34161f74be6aef95d (diff) |
WIP rejigging stuff
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/run.php | 95 | ||||
-rw-r--r-- | scripts/test.php | 13 |
2 files changed, 108 insertions, 0 deletions
diff --git a/scripts/run.php b/scripts/run.php new file mode 100644 index 0000000..3b4de6e --- /dev/null +++ b/scripts/run.php @@ -0,0 +1,95 @@ +<?php + +ini_set("display_errors", 1); +ini_set("display_startup_errors", 1); +error_reporting(E_ALL); + +// Pull in bootstrap +require(realpath(dirname(__FILE__) . "/../bootstrap.php")); + +// Set up siteroot +define('DIPPER_ROOT', realpath(dirname(__FILE__) . "/../")); + +// Handle options +$options = getopt('d:n:'); + +if (!array_key_exists('d', $options)) { + finish("please provide a domain (-d)"); +} + +if (!array_key_exists('n', $options)) { + finish("please provide a name (-n)"); +} + +/** + * Exit application with optional mesage + * + * @author Phil Burton <phil@pgburton.com> + * @param string $message [description] + */ +function finish($message) +{ + if ($message) { + message($message); + exit(); + } +} + +/** + * Echo a message + * + * @author Phil Burton <phil@pgburton.com> + * @param string $message [description] + */ +function message($message) +{ + echo $message . PHP_EOL; +} +// +// $domain = $options['d']; +// $name = $options['n']; +// +// $conf = include_once('nginx.php'); +// +// $conf = sprintf($conf[0], $domain, $name, $name, $name, $name, $name); +// +// echo "Making directory structure\n"; +// +// if (!mkdir('/web/sites/' . $name)) { +// echo "Failed to create '/web/sites/'" . $name . "\n"; +// exit(1); +// } +// +// chown('/web/sites/' . $name, "nginx"); +// +// if (!mkdir('/web/sites/' . $name . '/logs')) { +// echo "Failed to create '/web/sites/'" . $name . "/logs\n"; +// exit(1); +// } +// +// chown('/web/sites/' . $name . '/logs', "nginx"); +// +// +// if (!mkdir('/web/sites/' . $name . '/web')) { +// echo "Failed to create '/web/sites/'" . $name . "/web\n"; +// exit(1); +// } +// +// chown('/web/sites/' . $name . '/logs', "nginx"); +// +// echo "Complete\n"; +// +// if (!file_put_contents("/web/etc/nginx/" . $name . ".conf", $conf)) { +// echo "Failed to write nginx conf\n"; +// } +// +// chown('/web/etc/nginx/' . $name . ".conf", "nginx"); +// +// touch('/web/sites/' . $name . '/logs/' . $name . '.access_log'); +// chown('/web/sites/' . $name . '/logs/' . $name . '.access_log', "nginx"); +// +// touch('/web/sites/' . $name . '/logs/' . $name . '.error_log'); +// chown('/web/sites/' . $name . '/logs/' . $name . '.error_log', "nginx"); +// +// touch('/web/sites/' . $name . '/web/index.php'); +// chown('/web/sites/' . $name . '/web/index.php', "nginx"); diff --git a/scripts/test.php b/scripts/test.php new file mode 100644 index 0000000..83d8c5a --- /dev/null +++ b/scripts/test.php @@ -0,0 +1,13 @@ +<?php + +ini_set("display_errors", 1); +ini_set("display_startup_errors", 1); +error_reporting(E_ALL); + +// Pull in bootstrap +require(realpath(dirname(__FILE__) . "/../bootstrap.php")); + +// Set up siteroot +define('DIPPER_ROOT', realpath(dirname(__FILE__) . "/../")); + +new App\Script\Console; |