From add52d60970b78ceaff820daa20fceb407c9107f Mon Sep 17 00:00:00 2001 From: matthieu-rolland Date: Fri, 25 Feb 2022 15:57:42 +0100 Subject: [PATCH] cs fixer --- AdminSelfUpgrade.php | 5 +++-- classes/Twig/Form/FormRenderer.php | 1 - classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php | 14 ++------------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index 69b16d8d7..80097855e 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -178,6 +178,7 @@ public function __construct() (file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php') && !@copy(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php'))) { $this->_errors[] = $this->trans('Unable to create the directory "%s"', [_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'], 'Modules.Autoupgrade.Admin'); + return; } } @@ -431,7 +432,7 @@ public function postProcess() parent::postProcess(); } - private function extractFieldsToBeSavedInDB(UpgradeConfiguration $fileConfig): array + private function extractFieldsToBeSavedInDB(UpgradeConfiguration $fileConfig) { $DBConfig = []; @@ -451,7 +452,7 @@ private function extractFieldsToBeSavedInDB(UpgradeConfiguration $fileConfig): a /** * Process configuration values to be stored in database */ - private function processDatabaseConfigurationFields(array $config): void + private function processDatabaseConfigurationFields(array $config) { if (isset($config['PS_DISABLE_OVERRIDES'])) { foreach (Shop::getCompleteListOfShopsID() as $id_shop) { diff --git a/classes/Twig/Form/FormRenderer.php b/classes/Twig/Form/FormRenderer.php index 8d63bec31..1fc82811f 100644 --- a/classes/Twig/Form/FormRenderer.php +++ b/classes/Twig/Form/FormRenderer.php @@ -71,7 +71,6 @@ public function render($name, $fields, $tabname, $size, $icon) $required = !empty($field['required']); $disabled = !empty($field['disabled']); - if (in_array($key, UpgradeContainer::DB_CONFIG_KEYS)) { // values fetched from configuration in database $val = Configuration::get($key); diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php index 596a5b5fa..ad4ce735f 100644 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php +++ b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php @@ -28,8 +28,8 @@ namespace PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader; use Cache; -use PrestaShop\Module\AutoUpgrade\Log\LoggerInterface; use Configuration; +use PrestaShop\Module\AutoUpgrade\Log\LoggerInterface; use PrestaShop\Module\AutoUpgrade\UpgradeContainer; use PrestaShop\Module\AutoUpgrade\UpgradeException; use PrestaShop\Module\AutoUpgrade\UpgradeTools\ThemeAdapter; @@ -244,17 +244,7 @@ protected function checkVersionIsNewer($oldVersion) $versionCompare = version_compare($this->destinationUpgradeVersion, $oldVersion); if ($versionCompare === -1) { - throw new UpgradeException( - $this->container->getTranslator()->trans('[ERROR] Version to install is too old.', [], 'Modules.Autoupgrade.Admin') - . ' ' . - $this->container->getTranslator()->trans( - 'Current version: %oldversion%. Version to install: %newversion%.', - [ - '%oldversion%' => $oldVersion, - '%newversion%' => $this->destinationUpgradeVersion, - ], - 'Modules.Autoupgrade.Admin' - )); + throw new UpgradeException($this->container->getTranslator()->trans('[ERROR] Version to install is too old.', [], 'Modules.Autoupgrade.Admin') . ' ' . $this->container->getTranslator()->trans('Current version: %oldversion%. Version to install: %newversion%.', ['%oldversion%' => $oldVersion, '%newversion%' => $this->destinationUpgradeVersion], 'Modules.Autoupgrade.Admin')); } elseif ($versionCompare === 0) { throw new UpgradeException($this->container->getTranslator()->trans('You already have the %s version.', [$this->destinationUpgradeVersion], 'Modules.Autoupgrade.Admin')); }