2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
2008-02-25 03:10:37 +01:00
|
|
|
|
2017-06-12 08:04:34 +02:00
|
|
|
// CLI specific bootstrapping
|
2017-06-20 05:34:34 +02:00
|
|
|
use SilverStripe\Control\CLIRequestBuilder;
|
2017-06-21 11:04:39 +02:00
|
|
|
use SilverStripe\Control\HTTPApplication;
|
2017-06-20 06:39:43 +02:00
|
|
|
use SilverStripe\Core\CoreKernel;
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2017-06-12 08:04:34 +02:00
|
|
|
require __DIR__ . '/src/includes/autoload.php';
|
2012-02-12 21:22:11 +01:00
|
|
|
|
2017-06-20 05:34:34 +02: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 04:10:59 +02:00
|
|
|
// Build request and detect flush
|
2017-06-20 05:34:34 +02:00
|
|
|
$request = CLIRequestBuilder::createFromEnvironment();
|
2017-06-13 04:10:59 +02:00
|
|
|
|
|
|
|
// Default application
|
2017-06-20 06:39:43 +02:00
|
|
|
$kernel = new CoreKernel(BASE_PATH);
|
2017-06-12 08:04:34 +02:00
|
|
|
$app = new HTTPApplication($kernel);
|
2017-06-20 05:34:34 +02:00
|
|
|
$response = $app->handle($request);
|
|
|
|
$response->output();
|