Files
Grav/bin/grav

62 lines
1.8 KiB
Plaintext
Raw Normal View History

2014-08-02 12:11:33 -07:00
#!/usr/bin/env php
<?php
use Grav\Common\Composer;
use Grav\Common\Grav;
use Grav\Console\Cli;
use Symfony\Component\Console\Application;
\define('GRAV_CLI', true);
\define('GRAV_REQUEST_TIME', microtime(true));
if (!file_exists(__DIR__ . '/../vendor/autoload.php')){
// Before we can even start, we need to run composer first
require_once __DIR__ . '/../system/src/Grav/Common/Composer.php';
$composer = Composer::getComposerExecutor();
echo "Preparing to install vendor dependencies...\n\n";
echo system($composer.' --working-dir="'.__DIR__.'/../" --no-interaction --no-dev --prefer-dist -o install');
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
if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req));
}
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
// Set internal encoding.
if (!\extension_loaded('mbstring')) {
die("'mbstring' extension is not loaded. This is required for Grav to run correctly");
}
@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));
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!');
}
2016-03-07 17:01:52 -05:00
$app = new Application('Grav CLI Application', GRAV_VERSION);
2014-08-02 12:11:33 -07:00
$app->addCommands(array(
new Cli\InstallCommand(),
new Cli\ComposerCommand(),
new Cli\SandboxCommand(),
new Cli\CleanCommand(),
new Cli\ClearCacheCommand(),
new Cli\BackupCommand(),
new Cli\NewProjectCommand(),
new Cli\SchedulerCommand(),
new Cli\SecurityCommand(),
new Cli\LogViewerCommand(),
new Cli\YamlLinterCommand(),
new Cli\ServerCommand(),
new Cli\PageSystemValidatorCommand(),
2014-08-02 12:11:33 -07:00
));
$app->run();