2007-07-19 10:40:28 +00:00
|
|
|
<?php
|
2008-02-25 02:10:37 +00:00
|
|
|
|
2017-06-12 18:04:34 +12:00
|
|
|
// CLI specific bootstrapping
|
2017-06-20 15:34:34 +12:00
|
|
|
use SilverStripe\Control\CLIRequestBuilder;
|
2017-06-21 21:04:39 +12:00
|
|
|
use SilverStripe\Control\HTTPApplication;
|
2017-06-20 16:39:43 +12:00
|
|
|
use SilverStripe\Core\CoreKernel;
|
2016-08-19 10:51:35 +12:00
|
|
|
|
2017-06-12 18:04:34 +12:00
|
|
|
require __DIR__ . '/src/includes/autoload.php';
|
2012-02-12 12:22:11 -08:00
|
|
|
|
2017-06-20 15:34:34 +12:00
|
|
|
// Ensure that people can't access this from a web-server
|
|
|
|
if (!in_array(PHP_SAPI, ["cli", "cgi", "cgi-fcgi"])) {
|
|
|
|
echo "cli-script.php can't be run from a web request, you have to run it on the command-line.";
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
2017-06-13 14:10:59 +12:00
|
|
|
// Build request and detect flush
|
2017-06-20 15:34:34 +12:00
|
|
|
$request = CLIRequestBuilder::createFromEnvironment();
|
2017-06-13 14:10:59 +12:00
|
|
|
|
|
|
|
// Default application
|
2017-06-20 16:39:43 +12:00
|
|
|
$kernel = new CoreKernel(BASE_PATH);
|
2017-06-12 18:04:34 +12:00
|
|
|
$app = new HTTPApplication($kernel);
|
2017-06-20 15:34:34 +12:00
|
|
|
$response = $app->handle($request);
|
|
|
|
$response->output();
|