} public function updateModules() { } public function updateThemes() { } protected function __construct() { $command = new PS_CLI_Command('autoupgrade', 'Manage autoupgrade plugin'); $command->addOpt('show-status', 'Show configuration', false, 'boolean'); //$command->register($this); $this->register_command($command); } 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); } } } PS_CLI_CONFIGURE::register_plugin('PS_CLI_Autoupgrade');
$category->description = array($configuration->lang => $description); if (!Validate::isGenericName($meta_title)) { echo "Warning, {$meta_title} is not a valid value for meta_title\n"; $meta_title = ''; } $category->meta_title = array($configuration->lang => $meta_title); if (!Validate::isGenericName($meta_description)) { echo "Warning, {$meta_description} is not a valid value for meta_description\n"; $meta_description = ''; } $category->meta_description = array($configuration->lang => $meta_description); if (!Validate::isGenericName($meta_keywords)) { echo "Warning, {$meta_keywords} is not a valid value for meta_keywords\n"; $meta_keywords = ''; } $category->meta_keywords = array($configuration->lang => $meta_keywords); if ($category->add()) { if ($configuration->porcelain) { echo $category->id_cms_category; } else { echo "Successfully created category {$category->id_cms_category}\n"; } return true; } else { echo "Error, could not create category {$name}\n"; return false; } } } PS_CLI_CONFIGURE::register_plugin('PS_CLI_Cms');
{ $raw = Tools::file_get_contents(_PS_ROOT_DIR_ . Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST); $xmlModuleLists[] = @simplexml_load_string($raw, null, LIBXML_NOCDATA); $moduleStore = NULL; foreach ($xmlModuleLists as $xmlModuleList) { foreach ($xmlModuleList->module as $km) { if ($km->name != $moduleName) { continue; } $moduleStore = $km; } } if (is_null($moduleStore)) { echo "Error, could not find {$moduleName} in addons store...\n"; return false; } if (!($moduleArchive = self::_download_module_archive($moduleStore))) { echo "Error, could not download module\n"; return false; } if (!Tools::ZipExtract($moduleArchive, _PS_MODULE_DIR_)) { echo "Could not extract {$module->name} archive\n"; return false; } @unlink($moduleArchive); echo "Sucessfully downloaded module {$moduleName}\n"; return true; } } PS_CLI_CONFIGURE::register_plugin('PS_CLI_Modules');