Beispiel #1
0
define('DEV', ENV === DEV_ENV);
// Create the dependency injector for the Phalcon framework
$di = new DI();
$di->setShared('config', function () {
    $config = (require __DIR__ . "/config/config.php");
    return $config;
});
$config = $di->get('config');
if (!file_exists($config->path->tmpDir)) {
    mkdir($config->path->tmpDir);
}
// Setup composer autoloading so that it doesn't need to be specified in each Module
require_once $config->path->composerDir . 'autoload.php';
// Configure essential services
require $config->path->configDir . 'services.php';
$di = DI::getDefault();
$console = new WebirdConsole($di);
// Inject the console back into the DI to enabled it to handle batch tasks inside of a task
$di->setShared('console', $console);
$console->registerModules(['cli' => ['className' => 'Webird\\Cli\\Module']]);
if (DEV) {
    class_alias('\\Webird\\Debug', '\\Dbg', true);
}
try {
    $console->handle(['module' => 'cli', 'defaultCmd' => 'server', 'params' => $argv]);
} catch (PhalconException $e) {
    error_log($e->getMessage());
    exit(255);
} catch (\Exception $e) {
    error_log($e->getMessage());
    exit($e->getCode());
<?php

/**
 * @author Patsura Dmitry <*****@*****.**>
 */
include_once __DIR__ . '/../vendor/autoload.php';
define('APPLICATION_PATH', realpath(__DIR__));
define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
use App\Console\Command\SettingsUpdate;
use App\Console\Application;
$config = (include APPLICATION_PATH . "/config/core.php");
$application = new \Phalcony\Application(APPLICATION_ENV, $config, \Phalcon\DI\FactoryDefault\CLI::getDefault());
$application->bootstrap();
$consoleApplication = new Application($application);
$consoleApplication->add(new SettingsUpdate());
$consoleApplication->run();