public function run() { $arguments = PS_CLI_ARGUMENTS::getArgumentsInstance(); $interface = PS_CLI_INTERFACE::getInterface(); if ($arguments->getOpt('show-status')) { $table = new Cli\Table(); $table->setHeaders(array('Key', 'Configuration', 'Value')); PS_CLI_UTILS::add_configuration_value($table, 'PS_UPGRADE_CHANNEL', 'PrestaShop upgrade Channel'); $interface->add_table($table); } else { $interface->add_content("Not implemented"); $interface->set_ret_value(1); } }
public function run() { $arguments = PS_CLI_ARGUMENTS::getArgumentsInstance(); $interface = PS_CLI_INTERFACE::getInterface(); if ($opt = $arguments->getOpt('list-categories', false)) { $this->list_categories(); $status = true; } elseif ($opt = $arguments->getOpt('list-pages', false)) { $this->list_pages(); $status = true; } elseif ($pageId = $arguments->getOpt('delete-page', false)) { $status = $this->delete_page($pageId); } elseif ($pageId = $arguments->getOpt('disable-page', false)) { $status = $this->disable_page($pageId); } elseif ($pageId = $arguments->getOpt('enable-page', false)) { $status = $this->enable_page($pageId); } elseif ($catId = $arguments->getOpt('enable-category', false)) { $status = $this->enable_category($catId); } elseif ($catId = $arguments->getOpt('disable-category', false)) { $status = $this->disable_category($catId); } elseif ($arguments->getOpt('create-category', false)) { $name = $arguments->getOpt('name', false); $parent = $arguments->getOpt('parent', false); $rewrite = $arguments->getOpt('link-rewrite', false); $description = $arguments->getOpt('description', ''); $meta_title = $arguments->getOpt('meta_title', ''); $meta_description = $arguments->getOpt('meta_description', ''); $meta_keywords = $arguments->getOpt('meta_keywords', ''); $status = $this->create_category($parent, $name, $rewrite, $description, $meta_title, $meta_description, $meta_keywords); } elseif ($catId = $arguments->getOpt('delete-category', false)) { $status = $this->delete_category($catId); } else { $arguments->show_command_usage('cms'); $interface->exit_program(1); } if ($status === true) { $interface->exit_program(0); } else { $interface->exit_program(1); } }
public function register($handler) { $arguments = PS_CLI_ARGUMENTS::getArgumentsInstance(); $arguments->add_command($this, $handler); }
private function _register_plugin($pluginClass, $pluginInstance) { $commands = $pluginInstance->getCommands(); $arguments = PS_CLI_ARGUMENTS::getArgumentsInstance(); foreach ($commands as $command) { $arguments->add_command($command, $pluginInstance); } $this->pluginsLoaded[$pluginClass] = $pluginInstance; }
require_once PS_CLI_ROOT . '/PS_CLI/ps-cli_configure.php'; require_once PS_CLI_ROOT . '/PS_CLI/ps-cli_interface.php'; require_once PS_CLI_ROOT . '/PS_CLI/ps-cli_plugins.php'; require_once PS_CLI_ROOT . '/PS_CLI/ps-cli_command.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(); //load ps core PS_CLI_UTILS::ps_cli_load_ps_core(); $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) { $interface->add_exception($e); } catch (PrestaShopDatabaseException $e) { $interface->add_exception($e);