2014-08-02 12:11:33 -07:00
|
|
|
#!/usr/bin/env php
|
|
|
|
|
<?php
|
2015-05-15 19:54:33 +02:00
|
|
|
|
2021-02-04 21:09:42 -08:00
|
|
|
/**
|
2025-01-06 14:14:42 +00:00
|
|
|
* @copyright Copyright (c) 2015 - 2025 Trilby Media, LLC. All rights reserved.
|
2021-02-04 21:09:42 -08:00
|
|
|
* @license MIT License; see LICENSE file for details.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-05-14 21:37:47 +02:00
|
|
|
use Grav\Common\Composer;
|
2018-11-12 12:21:44 +02:00
|
|
|
use Grav\Common\Grav;
|
2021-01-06 13:45:19 +02:00
|
|
|
use Grav\Console\Application\GravApplication;
|
2015-05-14 21:37:47 +02:00
|
|
|
|
2018-11-12 12:21:44 +02:00
|
|
|
\define('GRAV_CLI', true);
|
|
|
|
|
\define('GRAV_REQUEST_TIME', microtime(true));
|
|
|
|
|
|
|
|
|
|
if (!file_exists(__DIR__ . '/../vendor/autoload.php')){
|
2014-09-04 16:29:10 -07:00
|
|
|
// Before we can even start, we need to run composer first
|
2018-11-12 12:21:44 +02:00
|
|
|
require_once __DIR__ . '/../system/src/Grav/Common/Composer.php';
|
|
|
|
|
|
2015-05-15 19:54:33 +02:00
|
|
|
$composer = Composer::getComposerExecutor();
|
2014-09-04 16:29:10 -07:00
|
|
|
echo "Preparing to install vendor dependencies...\n\n";
|
2015-05-15 19:54:33 +02:00
|
|
|
echo system($composer.' --working-dir="'.__DIR__.'/../" --no-interaction --no-dev --prefer-dist -o install');
|
2014-09-04 16:29:10 -07:00
|
|
|
echo "\n\n";
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-16 13:12:26 +03:00
|
|
|
$autoload = require __DIR__ . '/../vendor/autoload.php';
|
2014-08-02 12:11:33 -07:00
|
|
|
|
2022-02-14 09:38:22 +02:00
|
|
|
// Set timezone to default, falls back to system if php.ini not set
|
|
|
|
|
date_default_timezone_set(@date_default_timezone_get());
|
2020-02-10 09:50:39 +02:00
|
|
|
|
|
|
|
|
// Set internal encoding.
|
|
|
|
|
@ini_set('default_charset', 'UTF-8');
|
|
|
|
|
mb_internal_encoding('UTF-8');
|
|
|
|
|
|
2019-04-20 17:41:09 -06:00
|
|
|
$grav = Grav::instance(array('loader' => $autoload));
|
2018-11-12 12:21:44 +02:00
|
|
|
|
|
|
|
|
if (!file_exists(GRAV_ROOT . '/index.php')) {
|
2014-08-02 12:11:33 -07:00
|
|
|
exit('FATAL: Must be run from ROOT directory of Grav!');
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-06 13:45:19 +02:00
|
|
|
$app = new GravApplication('Grav CLI Application', GRAV_VERSION);
|
2014-08-02 12:11:33 -07:00
|
|
|
$app->run();
|