define('PHALCON_VERSION_REQUIRED', '1.3.1'); define('PHP_VERSION_REQUIRED', '5.4.14'); /** * Check phalcon framework installation. */ if (!extension_loaded('phalcon')) { printf('Install Phalcon framework %s', PHALCON_VERSION_REQUIRED); exit(1); } /** * Pathes. */ define('DS', DIRECTORY_SEPARATOR); if (!defined('ROOT_PATH')) { define('ROOT_PATH', dirname(dirname(__FILE__))); } if (!defined('PUBLIC_PATH')) { define('PUBLIC_PATH', dirname(__FILE__)); } require_once ROOT_PATH . "/app/engine/Config.php"; require_once ROOT_PATH . "/app/engine/Exception.php"; require_once ROOT_PATH . "/app/engine/ApplicationInitialization.php"; require_once ROOT_PATH . "/app/engine/Application.php"; if (php_sapi_name() !== 'cli') { $application = new Engine\Application(); } else { require_once ROOT_PATH . "/app/engine/Cli.php"; $application = new Engine\Cli(); } $application->run(); echo $application->getOutput();
if (PHP_SAPI != 'cli') { exit; } define('ROOT_PATH', str_replace('\\', '/', __DIR__)); $dir = dirname(__DIR__); $appDir = $dir . '/app/'; require $appDir . '/app/functions/core.php'; require $appDir . '/app/config/defined.php'; require $appDir . '/app/engine/PhpError.php'; require $appDir . '/app/engine/Cli.php'; register_shutdown_function(['engine\\PhpError', 'runtimeShutdown']); $configPath = $appDir . '/app/config/'; $config = $configPath . 'config.php'; try { $app = new Engine\Cli(); set_error_handler(['engine\\PhpError', 'errorHandler']); $app->setAutoload($appDir . 'app/'); $app->setConfig($config); if ($key = array_search('--single', $argv)) { $app->setSingleInstance(TRUE); register_shutdown_function([$app, 'removeProcessInstance']); } if ($key = array_search('--debug', $argv)) { $app->setDebug(TRUE); } $app->setArgs($argv, $argc); $app->run(); } catch (Exception $e) { echo $e; exit(255); }