$extensionLoaded = false; include dirname(__FILE__) . '/scripts/Phalcon/Script.php'; throw new Exception(sprintf("Phalcon extension isn't installed, follow these instructions to install it: %s", Script::DOC_INSTALL_URL)); } $loader = new Loader(); $loader->registerDirs(array(__DIR__ . '/scripts/'))->registerNamespaces(array('Phalcon' => __DIR__ . '/scripts/'))->register(); if (Version::getId() < Script::COMPATIBLE_VERSION) { throw new Exception(sprintf("Your Phalcon version isn't compatible with Developer Tools, download the latest at: %s", Script::DOC_DOWNLOAD_URL)); } if (!defined('TEMPLATE_PATH')) { define('TEMPLATE_PATH', __DIR__ . '/templates'); } $vendor = sprintf('Phalcon DevTools (%s)', Version::get()); print PHP_EOL . Color::colorize($vendor, Color::FG_GREEN, Color::AT_BOLD) . PHP_EOL . PHP_EOL; $eventsManager = new EventsManager(); $eventsManager->attach('command', new CommandsListener()); $script = new Script($eventsManager); $commandsToEnable = array('\\Phalcon\\Commands\\Builtin\\Enumerate', '\\Phalcon\\Commands\\Builtin\\Controller', '\\Phalcon\\Commands\\Builtin\\Model', '\\Phalcon\\Commands\\Builtin\\AllModels', '\\Phalcon\\Commands\\Builtin\\Project', '\\Phalcon\\Commands\\Builtin\\Scaffold', '\\Phalcon\\Commands\\Builtin\\Migration', '\\Phalcon\\Commands\\Builtin\\Webtools'); foreach ($commandsToEnable as $command) { $script->attach(new $command($script, $eventsManager)); } $script->run(); } catch (PhalconException $e) { print Color::error($e->getMessage()) . PHP_EOL; } catch (Exception $e) { if ($extensionLoaded) { print Color::error($e->getMessage()) . PHP_EOL; } else { print 'ERROR: ' . $e->getMessage() . PHP_EOL; } }
try { if (!extension_loaded('phalcon')) { throw new Exception("Phalcon extension isn't installed, follow these instructions to install it: " . 'https://docs.phalconphp.com/en/latest/reference/install.html'); } $loader = new Loader(); $loader->registerDirs(array(__DIR__ . '/scripts/'))->registerNamespaces(array('Phalcon' => __DIR__ . '/scripts/'))->register(); if (file_exists('.phalcon/autoload.php')) { require_once '.phalcon/autoload.php'; } if (Version::getId() < Script::COMPATIBLE_VERSION) { throw new Exception(sprintf("Your Phalcon version isn't compatible with Developer Tools, download the latest at: %s", Script::DOC_DOWNLOAD_URL)); } defined('TEMPLATE_PATH') || define('TEMPLATE_PATH', __DIR__ . '/templates'); $vendor = sprintf('Phalcon DevTools (%s)', Version::get()); print PHP_EOL . Color::colorize($vendor, Color::FG_GREEN, Color::AT_BOLD) . PHP_EOL . PHP_EOL; $eventsManager = new EventsManager(); $eventsManager->attach('command', new CommandsListener()); $script = new Script($eventsManager); $commandsToEnable = [Enumerate::class, Controller::class, Module::class, Model::class, AllModels::class, Project::class, Scaffold::class, Migration::class, Webtools::class]; $script->loadUserScripts(); foreach ($commandsToEnable as $command) { $script->attach(new $command($script, $eventsManager)); } $script->run(); } catch (PhalconException $e) { fwrite(STDERR, Color::error($e->getMessage()) . PHP_EOL); exit(1); } catch (Exception $e) { fwrite(STDERR, 'ERROR: ' . $e->getMessage() . PHP_EOL); exit(1); }