diff --git a/Readme.md b/Readme.md index c3ae80766..0c8ade197 100644 --- a/Readme.md +++ b/Readme.md @@ -8,15 +8,15 @@ This module is compatible with all PrestaShop 1.6 & 1.7. # Prerequisites * PrestaShop 1.6 or 1.7 -* PHP 5.6+ +* PHP 5.6+ -# Installation +For older PHP versions, see previous releases of the module [(ex. v1.6.8)](https://github.com/PrestaShop/autoupgrade/releases/tag/v1.6.8). +Note they are unsupported and we strongly recommend you to upgrade your PHP version. -You must have [composer][4] installed on your computer. Then, execute: +# Installation -``` -$ composer install -``` +All versions can be found in the [releases list](https://github.com/PrestaShop/autoupgrade/releases). +Zip archives can be directly uploaded on your module page. # Running an upgrade on PrestaShop @@ -42,7 +42,16 @@ $ php cli-upgrade.php --dir=admin-dev --channel=major PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements. -### Requirements +To contribute on this project, start by cloning the repository. +You must have [composer][4] installed on your computer. Run the following command: + +``` +$ composer install +``` + +Your module will be available with development libraries. + +### GitHub Requirements Contributors **must** follow the following rules: diff --git a/autoupgrade.php b/autoupgrade.php index 195c3d4a7..d89258096 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -31,7 +31,7 @@ public function __construct() $this->name = 'autoupgrade'; $this->tab = 'administration'; $this->author = 'PrestaShop'; - $this->version = '4.2.0'; + $this->version = '4.4.0'; $this->need_instance = 1; $this->bootstrap = true; diff --git a/classes/UpgradePage.php b/classes/UpgradePage.php index c4efc355a..0ef8adb60 100644 --- a/classes/UpgradePage.php +++ b/classes/UpgradePage.php @@ -384,7 +384,7 @@ private function _getJsErrorMsgs() 5 => $translator->trans('Cannot create settings file, if /app/config/parameters.php exists, please give the public write permissions to this file, else please create a file named parameters.php in config directory.', array(), $translationDomain), 6 => $translator->trans('Cannot write settings file, please create a file named settings.inc.php in the "config" directory.', array(), $translationDomain), 7 => $translator->trans('Impossible to upload the file!', array(), $translationDomain), - 8 => $translator->trans('Data integrity is not valided. Hack attempt?', array(), $translationDomain), + 8 => $translator->trans('Data integrity is not valid. Hack attempt?', array(), $translationDomain), 9 => $translator->trans('Impossible to read the content of a MySQL content file.', array(), $translationDomain), 10 => $translator->trans('Cannot access a MySQL content file.', array(), $translationDomain), 11 => $translator->trans('Error while inserting data in the database:', array(), $translationDomain), diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php index eb7eb60e7..b410228f4 100644 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php +++ b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php @@ -73,7 +73,7 @@ public function writeNewSettings() $writer = new SettingsFileWriter($this->container->getTranslator()); $writer->writeSettingsFile(SETTINGS_FILE, $datas); - $this->logger->debug($this->container->getTranslator()->trans('Settings file updated')); + $this->logger->debug($this->container->getTranslator()->trans('Settings file updated', array(), 'Modules.Autoupgrade.Admin')); } protected function initConstants() diff --git a/classes/UpgradeTools/SettingsFileWriter.php b/classes/UpgradeTools/SettingsFileWriter.php index a72ea7530..4e5e7c7ef 100644 --- a/classes/UpgradeTools/SettingsFileWriter.php +++ b/classes/UpgradeTools/SettingsFileWriter.php @@ -57,7 +57,7 @@ public function migrateSettingsFile(LoggerInterface $logger) public function writeSettingsFile($filePath, $data) { if (!is_writable($filePath)) { - throw new UpgradeException($this->translator->trans('Error when opening settings.inc.php file in write mode')); + throw new UpgradeException($this->translator->trans('Error when opening settings.inc.php file in write mode', array(), 'Modules.Autoupgrade.Admin')); } // Create backup file @@ -68,7 +68,7 @@ public function writeSettingsFile($filePath, $data) fwrite($fd, ' $value) { if (false === fwrite($fd, "define('$name', '{$this->checkString($value)}');" . PHP_EOL)) { - throw new UpgradeException($this->translator->trans('Error when generating new settings.inc.php file.')); + throw new UpgradeException($this->translator->trans('Error when generating new settings.inc.php file.', array(), 'Modules.Autoupgrade.Admin')); } } fclose($fd); diff --git a/classes/UpgradeTools/Translator.php b/classes/UpgradeTools/Translator.php index c00de4a6f..288453023 100644 --- a/classes/UpgradeTools/Translator.php +++ b/classes/UpgradeTools/Translator.php @@ -36,17 +36,26 @@ public function __construct($caller) $this->caller = $caller; } - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + /** + * Translate a string to the current language + * + * This methods has the same signature as the 1.7 trans method, but only relies + * on the module translation files. + * + * @param string $id Original text + * @param array $parameters Parameters to apply + * @param string $domain Unused + * @param string $locale Unused + * + * @return string Translated string with parameters applied + */ + public function trans($id, array $parameters = array(), $domain = 'Modules.Autoupgrade.Admin', $locale = null) { // If PrestaShop core is not instancied properly, do not try to translate if (!method_exists('\Context', 'getContext') || null === \Context::getContext()->language) { return $this->applyParameters($id, $parameters); } - if (method_exists('\Context', 'getTranslator')) { - return \Context::getContext()->getTranslator()->trans($id, $parameters, $domain, $locale); - } - if (method_exists('\Translate', 'getModuleTranslation')) { $translated = \Translate::getModuleTranslation('autoupgrade', $id, $this->caller, null); if (!count($parameters)) { diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 8f9819616..5abcc8031 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -32,9 +32,9 @@ class Upgrader { const DEFAULT_CHECK_VERSION_DELAY_HOURS = 12; - const DEFAULT_CHANNEL = 'major'; + const DEFAULT_CHANNEL = 'minor'; const DEFAULT_FILENAME = 'prestashop.zip'; - // @todo channel handling :) + public $addons_api = 'api.addons.prestashop.com'; public $rss_channel_link = 'https://api.prestashop.com/xml/channel.xml'; public $rss_md5file_link_dir = 'https://api.prestashop.com/xml/md5/'; diff --git a/config.xml b/config.xml index 6f778d842..b1a77f10e 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ autoupgrade - + diff --git a/views/templates/block/channelInfo.twig b/views/templates/block/channelInfo.twig index 95a94e297..9b7ac5c05 100644 --- a/views/templates/block/channelInfo.twig +++ b/views/templates/block/channelInfo.twig @@ -1,4 +1,3 @@ -

{% if upgradeInfo.branch is not empty %}
@@ -16,7 +15,7 @@
{% if upgradeInfo.version_name is not empty %}
- + {{ upgradeInfo.version_name }}
{% endif %} diff --git a/views/templates/block/checklist.twig b/views/templates/block/checklist.twig index 6b97e695a..08a1d1ef3 100644 --- a/views/templates/block/checklist.twig +++ b/views/templates/block/checklist.twig @@ -117,7 +117,7 @@ {% if isPrestaShopReady %} - {{ 'PrestaShop requirements are satisfied. '|trans }} + {{ 'PrestaShop requirements are satisfied.'|trans }} {% else %} {{ 'PrestaShop requirements are not satisfied. [1]See details[/1] or [2]ignore[/2].'|trans({ '[1]': '', diff --git a/views/templates/block/upgradeButtonBlock.twig b/views/templates/block/upgradeButtonBlock.twig index 159618ebe..6aa1e0668 100644 --- a/views/templates/block/upgradeButtonBlock.twig +++ b/views/templates/block/upgradeButtonBlock.twig @@ -1,4 +1,3 @@ -