Files
Grav/bin/grav
Andy Miller 5499f2edb6 Feature/scheduler (#2170)
* scheduler first commit

* moved jobs to config

* got some args working

* commands and static methods working.. events hooked up

* No longer dependent on `exec()`.. uses Symfony\Process

* More improvements

* support getAt()

* Make inflector available in DI

* Fix for inflector

* store job run states

* more improvements including cron twig function

* Add scheduler to event + cleanup

* improvements to the CLI command

* Added id field

* use proper func

* Added email

* Fix quotes

* Updated built-in composer

* Better command for adding the scheduler cron via terminal

* Fixed typo and added cron language

* Added Cron class to make at -> human readable date possible

* Added some checks when there are no jobs

* Added method to get CronExpression

* Revamped with Symfony 4.1 CLI updates
2018-09-05 19:02:12 -06:00

48 lines
1.5 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
define('GRAV_CLI', true);
if (!file_exists(__DIR__ . '/../vendor')){
require_once __DIR__ . '/../system/src/Grav/Common/Composer.php';
}
use Grav\Common\Grav;
use Grav\Common\Composer;
use Symfony\Component\Console\Application;
if (!file_exists(__DIR__ . '/../vendor')){
// Before we can even start, we need to run composer first
$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";
}
$autoload = require_once(__DIR__ . '/../vendor/autoload.php');
Grav::instance(array('loader' => $autoload));
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');
}
if (!file_exists(ROOT_DIR . 'index.php')) {
exit('FATAL: Must be run from ROOT directory of Grav!');
}
$app = new Application('Grav CLI Application', GRAV_VERSION);
$app->addCommands(array(
new \Grav\Console\Cli\InstallCommand(),
new \Grav\Console\Cli\ComposerCommand(),
new \Grav\Console\Cli\SandboxCommand(),
new \Grav\Console\Cli\CleanCommand(),
new \Grav\Console\Cli\ClearCacheCommand(),
new \Grav\Console\Cli\BackupCommand(),
new \Grav\Console\Cli\NewProjectCommand(),
new \Grav\Console\Cli\SchedulerCommand(),
));
$app->run();