public function getInstance() { if (self::$_instance === NULL) { self::$_instance = new PS_CLI_Hooks(); } return self::$_instance; }
require_once PS_CLI_ROOT . '/PS_CLI/ps-cli_hooks.php'; /* * Load 3d party librairies */ //php-cli-tools require_once PS_CLI_ROOT . '/lib/php-cli-tools/load-php-cli-tools.php'; //garden-cli argument parser require_once PS_CLI_ROOT . '/lib/garden-cli/Args.php'; require_once PS_CLI_ROOT . '/lib/garden-cli/Cli.php'; require_once PS_CLI_ROOT . '/lib/garden-cli/Table.php'; $conf = PS_CLI_Configure::getConfigurationInstance(); $conf->preload_configure(); $arguments = PS_CLI_Arguments::getArgumentsInstance(); $arguments->parse_arguments(); // run before_load_ps_core hooks PS_CLI_Hooks::callHooks('before_load_ps_core'); //load ps core if ($conf->loadPsCore) { PS_CLI_UTILS::ps_cli_load_ps_core(); } else { echo "[DEBUG]: PS core not loaded\n"; } $conf->postload_configure(); $interface = PS_CLI_INTERFACE::getInterface(); // todo: create a runner and export this code in it; we'll need to create an interface instance before //find what to run try { $arguments->runArgCommand(); } catch (Exception $e) { $interface->add_exception($e); } catch (PrestaShopException $e) {
protected final function registerHook($event, $callback, $args = array()) { PS_CLI_Hooks::registerHook($this, $event, $callback, $args); }