From 7034016397a3a366d806d2ad1945a183ec7c542d Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Thu, 31 Jan 2019 16:25:15 +0000 Subject: [PATCH 01/35] Handle PrestaShop version in AppKernel --- classes/PrestashopConfiguration.php | 7 + tests/PrestaShopConfigurationTest.php | 14 ++ tests/fixtures/AppKernelExample.php.txt | 244 ++++++++++++++++++++++++ 3 files changed, 265 insertions(+) create mode 100644 tests/fixtures/AppKernelExample.php.txt diff --git a/classes/PrestashopConfiguration.php b/classes/PrestashopConfiguration.php index 566fec8b2..f252703ac 100644 --- a/classes/PrestashopConfiguration.php +++ b/classes/PrestashopConfiguration.php @@ -104,6 +104,7 @@ public function getPrestaShopVersion() $files = array( $this->psRootDir . '/config/settings.inc.php', $this->psRootDir . '/config/autoload.php', + $this->psRootDir . '/app/AppKernel.php', ); foreach ($files as $file) { $version = $this->findPrestaShopVersionInFile(file_get_contents($file)); @@ -153,10 +154,16 @@ protected function getRootWritableDetails() public function findPrestaShopVersionInFile($content) { $matches = array(); + // Example: define('_PS_VERSION_', '1.7.3.4'); if (1 === preg_match("/define\([\"']_PS_VERSION_[\"'], [\"'](?[0-9.]+)[\"']\)/", $content, $matches)) { return $matches['version']; } + // Example: const VERSION = '1.7.6.0'; + if (1 === preg_match("/const VERSION = [\"'](?[0-9.]+)[\"'];/", $content, $matches)) { + return $matches['version']; + } + return false; } } diff --git a/tests/PrestaShopConfigurationTest.php b/tests/PrestaShopConfigurationTest.php index db72fe7ee..847172edc 100644 --- a/tests/PrestaShopConfigurationTest.php +++ b/tests/PrestaShopConfigurationTest.php @@ -51,4 +51,18 @@ public function testPrestaShopVersionInFile() $this->assertSame('1.6.1.18', $class->findPrestaShopVersionInFile($content)); } + + /** + * From PrestaShop 1.7.5.0, the version is stored in the class AppKernel + */ + public function testPrestaShopVersionInAppKernel() + { + $class = new PrestashopConfiguration(__DIR__, __DIR__); + $this->assertSame( + '1.7.6.0', + $class->findPrestaShopVersionInFile( + file_get_contents(__DIR__.'/fixtures/AppKernelExample.php.txt') + ) + ); + } } diff --git a/tests/fixtures/AppKernelExample.php.txt b/tests/fixtures/AppKernelExample.php.txt new file mode 100644 index 000000000..5a57c8658 --- /dev/null +++ b/tests/fixtures/AppKernelExample.php.txt @@ -0,0 +1,244 @@ + + * @copyright 2007-2018 PrestaShop SA + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +use Doctrine\DBAL\DriverManager; +use PrestaShopBundle\Kernel\ModuleRepository; +use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Kernel; + +class AppKernel extends Kernel +{ + const VERSION = '1.7.6.0'; + const MAJOR_VERSION_STRING = '1.7'; + const MAJOR_VERSION = 17; + const MINOR_VERSION = 6; + const RELEASE_VERSION = 0; + + /** + * @{inheritdoc} + */ + public function registerBundles() + { + $bundles = array( + new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), + new Symfony\Bundle\SecurityBundle\SecurityBundle(), + new Symfony\Bundle\TwigBundle\TwigBundle(), + new Symfony\Bundle\MonologBundle\MonologBundle(), + new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), + new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), + new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), + // PrestaShop Core bundle + new PrestaShopBundle\PrestaShopBundle(), + // PrestaShop Translation parser + new PrestaShop\TranslationToolsBundle\TranslationToolsBundle(), + // REST API consumer + new Csa\Bundle\GuzzleBundle\CsaGuzzleBundle(), + new League\Tactician\Bundle\TacticianBundle(), + ); + + if (in_array($this->getEnvironment(), array('dev', 'test'), true)) { + $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); + $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); + $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); + } + + if ('dev' === $this->getEnvironment()) { + $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); + } + + /* Will not work until PrestaShop is installed */ + if ($this->parametersFileExists()) { + try { + $this->enableComposerAutoloaderOnModules($this->getActiveModules()); + } catch (\Exception $e) { + } + } + + return $bundles; + } + + /** + * @{inheritdoc} + */ + protected function getKernelParameters() + { + $kernelParameters = parent::getKernelParameters(); + + $activeModules = array(); + + /* Will not work until PrestaShop is installed */ + if ($this->parametersFileExists()) { + try { + $this->getConnection()->connect(); + $activeModules = $this->getActiveModules(); + } catch (\Exception $e) { + } + } + + return array_merge( + $kernelParameters, + array('kernel.active_modules' => $activeModules) + ); + } + + /** + * @{inheritdoc} + */ + public function getRootDir() + { + return __DIR__; + } + + /** + * @{inheritdoc} + */ + public function getCacheDir() + { + return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); + } + + /** + * @{inheritdoc} + */ + public function getLogDir() + { + return dirname(__DIR__).'/var/logs'; + } + + /** + * @{inheritdoc} + * @throws \Exception + */ + public function registerContainerConfiguration(LoaderInterface $loader) + { + $loader->load(function (ContainerBuilder $container) { + $container->setParameter('container.autowiring.strict_mode', true); + $container->setParameter('container.dumper.inline_class_loader', false); + $container->addObjectResource($this); + }); + + $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); + } + + /** + * Return all active modules. + * + * @return array list of modules names. + * @throws \Doctrine\DBAL\DBALException + */ + private function getActiveModules() + { + $databasePrefix = $this->getParameters()['database_prefix']; + + $modulesRepository = new ModuleRepository( + $this->getConnection(), + $databasePrefix + ); + + return $modulesRepository->getActiveModules(); + } + + /** + * @return array The root parameters of PrestaShop. + */ + private function getParameters() + { + if ($this->parametersFileExists()) { + $config = require $this->getParametersFile(); + + return $config['parameters']; + } + + return array(); + } + + /** + * @var bool + * @return bool + */ + private function parametersFileExists() + { + return file_exists($this->getParametersFile()); + } + + /** + * @return string file path to PrestaShop configuration parameters. + */ + private function getParametersFile() + { + return $this->getRootDir().'/config/parameters.php'; + } + + /** + * @return \Doctrine\DBAL\Connection + * @throws \Doctrine\DBAL\DBALException + */ + private function getConnection() + { + $parameters = $this->getParameters(); + + return DriverManager::getConnection(array( + 'dbname' => $parameters['database_name'], + 'user' => $parameters['database_user'], + 'password' => $parameters['database_password'], + 'host' => $parameters['database_host'], + 'port' => $parameters['database_port'], + 'charset' => 'utf8', + 'driver' => 'pdo_mysql', + )); + } + + /** + * Enable auto loading of module Composer autoloader if needed. + * Need to be done as earlier as possible in application lifecycle. + * + * @param array $modules the list of modules + */ + private function enableComposerAutoloaderOnModules($modules) + { + foreach ($modules as $module) { + $autoloader = __DIR__.'/../modules/'.$module.'/vendor/autoload.php'; + + if (file_exists($autoloader)) { + include_once $autoloader; + } + } + } + + /** + * Gets the application root dir. + * Override Kernel due to the fact that we remove the composer.json in + * downloaded package. More we are not a framework and the root directory + * should always be the parent of this file. + * + * @return string The project root dir + */ + public function getProjectDir() + { + return realpath(__DIR__ . '/..'); + } +} From b446c604efda0a6036a56312cc281b06e09eefea Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:26:28 +0100 Subject: [PATCH 02/35] Function to constant --- AdminSelfUpgrade.php | 2 +- ajax-upgradetabconfig.php | 2 +- autoupgrade.php | 2 +- classes/ConfigurationTest.php | 2 +- cli-rollback.php | 2 +- cli-upgrade.php | 2 +- tests/TranslatorTest.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index 83a12bbc0..8ecd30c1a 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -428,6 +428,6 @@ public function display() */ public function trans($id, array $parameters = array(), $domain = null, $locale = null) { - return (new \PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator(get_class()))->trans($id, $parameters, $domain, $locale); + return (new \PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator(__CLASS__))->trans($id, $parameters, $domain, $locale); } } diff --git a/ajax-upgradetabconfig.php b/ajax-upgradetabconfig.php index cf5ade991..1e6c2bfa2 100644 --- a/ajax-upgradetabconfig.php +++ b/ajax-upgradetabconfig.php @@ -40,7 +40,7 @@ */ function autoupgrade_init_container($callerFilePath) { - if (php_sapi_name() === 'cli') { + if (PHP_SAPI === 'cli') { $_POST['dir'] = getopt('', array('dir:'))['dir']; } diff --git a/autoupgrade.php b/autoupgrade.php index 439c1d18b..6d1b4cdef 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -203,7 +203,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale { require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/classes/UpgradeTools/Translator.php'; - $translator = new \PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator(get_class()); + $translator = new \PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator(__CLASS__); return $translator->trans($id, $parameters, $domain, $locale); } } diff --git a/classes/ConfigurationTest.php b/classes/ConfigurationTest.php index d4cc9302b..0147b81c6 100755 --- a/classes/ConfigurationTest.php +++ b/classes/ConfigurationTest.php @@ -48,7 +48,7 @@ public static function run($ptr, $arg = 0) // Misc functions public static function test_phpversion() { - return version_compare(substr(phpversion(), 0, 3), '5.4', '>='); + return version_compare(substr(PHP_VERSION, 0, 3), '5.4', '>='); } public static function test_mysql_support() diff --git a/cli-rollback.php b/cli-rollback.php index bcd4ce242..efdbd886e 100644 --- a/cli-rollback.php +++ b/cli-rollback.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -if (php_sapi_name() !== 'cli') { +if (PHP_SAPI !== 'cli') { echo 'This script must be called from CLI'; exit(1); } diff --git a/cli-upgrade.php b/cli-upgrade.php index 027d8e82f..2ab08e220 100644 --- a/cli-upgrade.php +++ b/cli-upgrade.php @@ -25,7 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -if (php_sapi_name() !== 'cli') { +if (PHP_SAPI !== 'cli') { echo 'This script must be called from CLI'; exit(1); } diff --git a/tests/TranslatorTest.php b/tests/TranslatorTest.php index 3c2a5d894..7b899fecb 100644 --- a/tests/TranslatorTest.php +++ b/tests/TranslatorTest.php @@ -37,7 +37,7 @@ class TranslatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->translator = new Translator(get_class()); + $this->translator = new Translator(__CLASS__); } /** From 53cdefddeea8526c5cf486a366035a0d5840af46 Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Fri, 1 Feb 2019 11:27:03 +0000 Subject: [PATCH 03/35] Do not upgrade PrestaShop when already on the last version --- classes/TaskRunner/Upgrade/UpgradeNow.php | 6 ++++++ classes/Upgrader.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/TaskRunner/Upgrade/UpgradeNow.php b/classes/TaskRunner/Upgrade/UpgradeNow.php index fa3d4412d..ad09d8223 100644 --- a/classes/TaskRunner/Upgrade/UpgradeNow.php +++ b/classes/TaskRunner/Upgrade/UpgradeNow.php @@ -53,6 +53,12 @@ public function run() $upgrader->checkPSVersion(false, array('minor')); } + if ($upgrader->isLastVersion()) { + $this->next = ''; + $this->logger->info($this->translator->trans('You already have the %s version.', array($upgrader->version_name), 'Modules.Autoupgrade.Admin')); + return; + } + switch ($channel) { case 'directory': // if channel directory is chosen, we assume it's "ready for use" (samples already removed for example) diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 42f21d5fe..1504627d8 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -124,7 +124,7 @@ public function isLastVersion() $this->checkPSVersion(); } - return $this->need_upgrade; + return !$this->need_upgrade; } /** From 3780e9666a6117ae2d0f76e316048407b0a389c9 Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Fri, 1 Feb 2019 11:28:27 +0000 Subject: [PATCH 04/35] Add a Travis job for the last PS version and update the wrapper cli help --- .travis.yml | 3 +++ tests/testCliProcess.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14d30ed3c..79302d3ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,9 @@ env: CHANNEL=major - VERSION=1.6.1.10 CHANNEL=minor + # Check how the upgrade behaves with the latest PrestaShop + - VERSION=latest + CHANNEL=minor cache: directories: diff --git a/tests/testCliProcess.php b/tests/testCliProcess.php index c481dc20c..affb74986 100644 --- a/tests/testCliProcess.php +++ b/tests/testCliProcess.php @@ -57,9 +57,9 @@ function displayHelp() testCliProcess.php [Options] ------------------ Options ---help Display this message. +--help Display this message. ---admin-dir Tells where the admin directory is. +--dir Tells where the admin directory is. [UPGRADE] --channel Selects what upgrade to run (minor, major etc.) From 3296a082085a93454d90c0c87a3ce3c1cf32134c Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Wed, 26 Dec 2018 23:13:53 +0100 Subject: [PATCH 05/35] lossless compression --- AdminSelfUpgrade.gif | Bin 652 -> 626 bytes logo.gif | Bin 652 -> 626 bytes logo.png | Bin 4013 -> 2853 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/AdminSelfUpgrade.gif b/AdminSelfUpgrade.gif index 98135690867612ab16055ff813afeb7e16dafa20..98d0bc84a362f19bb42252bc425e96089ff02540 100755 GIT binary patch delta 134 zcmeBS{lvoU?&)S>nJB;@!0>G&cM797174u`lZBOwp^QNXqza^of&F|#SyOXaOk_(( zOH5IrU1w8ja(r26ex6g=nJB;@z;J9McM4+oa7KOs zgW^vXMlObW1|0?<02#-?e!ii;skuHTvZbRXrl`=avne$>zCJWRX$F2?DKKY|;Z iSUBX`W+;4k(ch}(#AYB7xL}zABf~!h0|yNO25SJClt<72 diff --git a/logo.gif b/logo.gif index 98135690867612ab16055ff813afeb7e16dafa20..98d0bc84a362f19bb42252bc425e96089ff02540 100755 GIT binary patch delta 134 zcmeBS{lvoU?&)S>nJB;@!0>G&cM797174u`lZBOwp^QNXqza^of&F|#SyOXaOk_(( zOH5IrU1w8ja(r26ex6g=nJB;@z;J9McM4+oa7KOs zgW^vXMlObW1|0?<02#-?e!ii;skuHTvZbRXrl`=avne$>zCJ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F@LrKd0nygTO9da9x>>JJv+!uL@37ObNVa8kwW(Q5~+;94A*>&?YAe(8N@ZQ zn9ox_J4*#_o|_&)9tm{#O8}OB(;1YY)W|5MSMzdjBO^TE#G6e^*bPYK4C=JO0zhdx zgA8lME|9}uK&&-+**f+(`y3ov7;v`c4YdL7^jy+rjl$1Gn!t+nRAD2I&4K(qh={}}iA zgM@9P1&HLl+baMdmrqQSxi;3aHx@R6l92$uw*UZrQ1FGqYe{d{;Ln?7EA+ftVQ*k7 z`q*iEL&)a#(N_YLxvw7P;+Kbgr{vaJ%P^q>p?dDujvEeZU9apF%ICgOkTauGXl)AFMo28FW(6vMIWqj z%?COF1%{!UR=HK_nNu7&wmXJMF9Bnu_(hJfgJveu1Ww63`~GZ3w*QyD#@#X zfe6s_iP00%SRgXTpU*j&P|`PHDOlAj36`bq(2|k zwQ1h>qVe2vl3-DW8IJ-vmdjtAb6*3AXykzQYO%PzTA_oS-D;6#w?!Gmed;K$1`<(i zZc99VF~_(PfdsW`<4&Gke<`oUvuRERa>$Epmy$;`Z8{#&_n$rz`R4h_ Date: Mon, 24 Dec 2018 16:35:29 +0100 Subject: [PATCH 06/35] Butify YML files --- docker-compose.yml | 50 ++++++++++++++++++++-------------------- tests/docker-compose.yml | 49 ++++++++++++++++++++++++++++----------- 2 files changed, 61 insertions(+), 38 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3a9de4f4c..a7d8a8f85 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,28 @@ version: '2' services: - mysql: - image: mysql:5.7 - ports: - - "3306" - environment: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: psreference - reference-release: - container_name: prestashop_autoupgrade - image: prestashop/prestashop:${VERSION} - volumes: - - ./:/var/www/html/modules/autoupgrade - environment: - DB_SERVER: mysql - DB_PASSWD: root - DB_NAME: psreference - PS_DOMAIN: localhost:8001 - PS_INSTALL_AUTO: 1 - PS_ERASE_DB: 1 - PS_FOLDER_ADMIN: admin-dev - PS_FOLDER_INSTALL: install-dev - depends_on: - - mysql - ports: - - "8001:80" + mysql: + image: mysql:5.7 + ports: + - '3306' + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: psreference + reference-release: + container_name: prestashop_autoupgrade + image: prestashop/prestashop:${VERSION} + volumes: + - ./:/var/www/html/modules/autoupgrade + environment: + DB_SERVER: mysql + DB_PASSWD: root + DB_NAME: psreference + PS_DOMAIN: localhost:8001 + PS_INSTALL_AUTO: 1 + PS_ERASE_DB: 1 + PS_FOLDER_ADMIN: admin-dev + PS_FOLDER_INSTALL: install-dev + depends_on: + - mysql + ports: + - '8001:80' diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index c5ac32e76..c68015059 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -7,9 +7,25 @@ services: SELENIUM_HOST: selenium-chrome URL: prestashop-web depends_on: - - "prestashop" - - "selenium-chrome" - command: ["/tmp/wait-for-it.sh", "--timeout=200", "--strict", "prestashop:80", "--", "/tmp/node_modules/mocha/bin/mocha /tmp/test/campaigns/high/13_installation", "--URL=prestashop-web", "--SELENIUM=selenium-chrome", "--DIR=/home/seluser/Downloads/", "--DB_SERVER=db", "--DB_USER=root", "--DB_PASSWD=admin", "--RCTARGET=/tmp/", "--RCLINK=http://localhost/prestashop_1.7.3.0-RC1.zip"] + - 'prestashop' + - 'selenium-chrome' + command: + [ + '/tmp/wait-for-it.sh', + '--timeout=200', + '--strict', + 'prestashop:80', + '--', + '/tmp/node_modules/mocha/bin/mocha /tmp/test/campaigns/high/13_installation', + '--URL=prestashop-web', + '--SELENIUM=selenium-chrome', + '--DIR=/home/seluser/Downloads/', + '--DB_SERVER=db', + '--DB_USER=root', + '--DB_PASSWD=admin', + '--RCTARGET=/tmp/', + '--RCLINK=http://localhost/prestashop_1.7.3.0-RC1.zip', + ] volumes: - ./screenshots/:/home/test/screenshots/ - downloads:/home/seluser/Downloads @@ -26,25 +42,33 @@ services: PS_FOLDER_ADMIN: admin-dev PS_FOLDER_INSTALL: install-dev depends_on: - - "db" - command: ["/tmp/wait-for-it.sh", "--timeout=60", "--strict", "db:3306", "--", "/tmp/docker_run.sh"] + - 'db' + command: + [ + '/tmp/wait-for-it.sh', + '--timeout=60', + '--strict', + 'db:3306', + '--', + '/tmp/docker_run.sh', + ] ports: - - 8002:80 + - 8002:80 networks: default: - aliases: - - prestashop-web + aliases: + - prestashop-web selenium-chrome: image: selenium/standalone-chrome ports: - 4444:4444 volumes: - - downloads:/home/seluser/Downloads + - downloads:/home/seluser/Downloads networks: default: - aliases: - - selenium-chrome + aliases: + - selenium-chrome db: image: mysql @@ -54,8 +78,7 @@ services: - default volumes: - downloads: + downloads: networks: default: - From 3c56978b63beb5cd2bde4faac061b023d4290d27 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:24:29 +0100 Subject: [PATCH 07/35] Logical operators --- classes/TaskRunner/Upgrade/UpgradeFiles.php | 2 +- classes/Tools14.php | 78 +++++++++---------- .../CoreUpgrader/CoreUpgrader.php | 38 ++++----- functions.php | 24 +++--- 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/classes/TaskRunner/Upgrade/UpgradeFiles.php b/classes/TaskRunner/Upgrade/UpgradeFiles.php index 5a86965d5..9109ca634 100644 --- a/classes/TaskRunner/Upgrade/UpgradeFiles.php +++ b/classes/TaskRunner/Upgrade/UpgradeFiles.php @@ -151,7 +151,7 @@ public function upgradeThisFile($file) } if (is_dir($orig)) { // if $dest is not a directory (that can happen), just remove that file - if (!is_dir($dest) and file_exists($dest)) { + if (!is_dir($dest) && file_exists($dest)) { unlink($dest); $this->logger->debug($this->translator->trans('[WARNING] File %1$s has been deleted.', array($file), 'Modules.Autoupgrade.Admin')); } diff --git a/classes/Tools14.php b/classes/Tools14.php index d9b0ffd2b..c09719654 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -76,7 +76,7 @@ public static function redirect($url, $baseUri = __PS_BASE_URI__) $baseUri = ''; } - if (isset($_SERVER['HTTP_REFERER']) and ($url == $_SERVER['HTTP_REFERER'])) { + if (isset($_SERVER['HTTP_REFERER']) && ($url == $_SERVER['HTTP_REFERER'])) { header('Location: ' . $_SERVER['HTTP_REFERER']); } else { header('Location: ' . $baseUri . $url); @@ -206,7 +206,7 @@ public static function getShopDomainSsl($http = false, $entities = false) */ public static function getServerName() { - if (isset($_SERVER['HTTP_X_FORWARDED_SERVER']) and $_SERVER['HTTP_X_FORWARDED_SERVER']) { + if (isset($_SERVER['HTTP_X_FORWARDED_SERVER']) && $_SERVER['HTTP_X_FORWARDED_SERVER']) { return $_SERVER['HTTP_X_FORWARDED_SERVER']; } @@ -221,7 +221,7 @@ public static function getServerName() public static function getRemoteAddr() { // This condition is necessary when using CDN, don't remove it. - if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) and $_SERVER['HTTP_X_FORWARDED_FOR'] and (!isset($_SERVER['REMOTE_ADDR']) or preg_match('/^127\..*/i', trim($_SERVER['REMOTE_ADDR'])) or preg_match('/^172\.16.*/i', trim($_SERVER['REMOTE_ADDR'])) or preg_match('/^192\.168\.*/i', trim($_SERVER['REMOTE_ADDR'])) or preg_match('/^10\..*/i', trim($_SERVER['REMOTE_ADDR'])))) { + if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] && (!isset($_SERVER['REMOTE_ADDR']) || preg_match('/^127\..*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^172\.16.*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^192\.168\.*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^10\..*/i', trim($_SERVER['REMOTE_ADDR'])))) { if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) { $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); @@ -293,7 +293,7 @@ public static function secureReferrer($referrer) */ public static function getValue($key, $defaultValue = false) { - if (!isset($key) or empty($key) or !is_string($key)) { + if (!isset($key) || empty($key) || !is_string($key)) { return false; } $ret = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $defaultValue)); @@ -307,7 +307,7 @@ public static function getValue($key, $defaultValue = false) public static function getIsset($key) { - if (!isset($key) or empty($key) or !is_string($key)) { + if (!isset($key) || empty($key) || !is_string($key)) { return false; } @@ -326,13 +326,13 @@ public static function setCookieLanguage() /* If language does not exist or is disabled, erase it */ if ($cookie->id_lang) { $lang = new Language((int) $cookie->id_lang); - if (!Validate::isLoadedObject($lang) or !$lang->active) { + if (!Validate::isLoadedObject($lang) || !$lang->active) { $cookie->id_lang = null; } } /* Automatically detect language if not already defined */ - if (!$cookie->id_lang and isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + if (!$cookie->id_lang && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $array = explode(',', self::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); if (self::strlen($array[0]) > 2) { $tab = explode('-', $array[0]); @@ -342,14 +342,14 @@ public static function setCookieLanguage() } if (Validate::isLanguageIsoCode($string)) { $lang = new Language((int) (Language::getIdByIso($string))); - if (Validate::isLoadedObject($lang) and $lang->active) { + if (Validate::isLoadedObject($lang) && $lang->active) { $cookie->id_lang = (int) ($lang->id); } } } /* If language file not present, you must use default language file */ - if (!$cookie->id_lang or !Validate::isUnsignedId($cookie->id_lang)) { + if (!$cookie->id_lang || !Validate::isUnsignedId($cookie->id_lang)) { $cookie->id_lang = (int) (Configuration::get('PS_LANG_DEFAULT')); } @@ -366,7 +366,7 @@ public static function switchLanguage() { global $cookie; - if ($id_lang = (int) (self::getValue('id_lang')) and Validate::isUnsignedId($id_lang)) { + if ($id_lang = (int) (self::getValue('id_lang')) && Validate::isUnsignedId($id_lang)) { $cookie->id_lang = $id_lang; } } @@ -381,9 +381,9 @@ public static function setCurrency() global $cookie; if (self::isSubmit('SubmitCurrency')) { - if (isset($_POST['id_currency']) and is_numeric($_POST['id_currency'])) { + if (isset($_POST['id_currency']) && is_numeric($_POST['id_currency'])) { $currency = Currency::getCurrencyInstance((int) ($_POST['id_currency'])); - if (is_object($currency) and $currency->id and !$currency->deleted) { + if (is_object($currency) && $currency->id && !$currency->deleted) { $cookie->id_currency = (int) ($currency->id); } } @@ -391,12 +391,12 @@ public static function setCurrency() if ((int) $cookie->id_currency) { $currency = Currency::getCurrencyInstance((int) $cookie->id_currency); - if (is_object($currency) and (int) $currency->id and (int) $currency->deleted != 1 and $currency->active) { + if (is_object($currency) && (int) $currency->id && (int) $currency->deleted != 1 && $currency->active) { return $currency; } } $currency = Currency::getCurrencyInstance((int) (Configuration::get('PS_CURRENCY_DEFAULT'))); - if (is_object($currency) and $currency->id) { + if (is_object($currency) && $currency->id) { $cookie->id_currency = (int) ($currency->id); } @@ -523,10 +523,10 @@ public static function dateFormat($params, &$smarty) */ public static function displayDate($date, $id_lang, $full = false, $separator = '-') { - if (!$date or !($time = strtotime($date))) { + if (!$date || !($time = strtotime($date))) { return $date; } - if (!Validate::isDate($date) or !Validate::isBool($full)) { + if (!Validate::isDate($date) || !Validate::isBool($full)) { die(self::displayError('Invalid date')); } @@ -618,17 +618,17 @@ public static function displayError($string = 'Fatal error', $htmlentities = tru return $string; global $_ERRORS, $cookie; - $iso = strtolower(Language::getIsoById((is_object($cookie) and $cookie->id_lang) ? (int) $cookie->id_lang : (int) Configuration::get('PS_LANG_DEFAULT'))); + $iso = strtolower(Language::getIsoById((is_object($cookie) && $cookie->id_lang) ? (int) $cookie->id_lang : (int) Configuration::get('PS_LANG_DEFAULT'))); @include_once _PS_TRANSLATIONS_DIR_ . $iso . '/errors.php'; - if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_ and $string == 'Fatal error') { + if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $string == 'Fatal error') { return '
' . print_r(debug_backtrace(), true) . '
'; } if (!is_array($_ERRORS)) { return str_replace('"', '"', $string); } $key = md5(str_replace('\'', '\\\'', $string)); - $str = (isset($_ERRORS) and is_array($_ERRORS) and key_exists($key, $_ERRORS)) ? ($htmlentities ? htmlentities($_ERRORS[$key], ENT_COMPAT, 'UTF-8') : $_ERRORS[$key]) : $string; + $str = (isset($_ERRORS) && is_array($_ERRORS) && key_exists($key, $_ERRORS)) ? ($htmlentities ? htmlentities($_ERRORS[$key], ENT_COMPAT, 'UTF-8') : $_ERRORS[$key]) : $string; return str_replace('"', '"', stripslashes($str)); } @@ -681,8 +681,8 @@ public static function p($object) public static function isSubmit($submit) { return - isset($_POST[$submit]) or isset($_POST[$submit . '_x']) or isset($_POST[$submit . '_y']) - or isset($_GET[$submit]) or isset($_GET[$submit . '_x']) or isset($_GET[$submit . '_y']) + isset($_POST[$submit]) || isset($_POST[$submit . '_x']) || isset($_POST[$submit . '_y']) + || isset($_GET[$submit]) || isset($_GET[$submit . '_x']) || isset($_GET[$submit . '_y']) ; } @@ -697,7 +697,7 @@ public static function getMetaTags($id_lang, $page_name) { global $maintenance; - if (!(isset($maintenance) and (!in_array(self::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP')))))) { + if (!(isset($maintenance) && (!in_array(self::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP')))))) { /* Products specifics meta tags */ if ($id_product = self::getValue('id_product')) { $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' @@ -818,9 +818,9 @@ public static function getHomeMetaTags($id_lang, $page_name) { /* Metas-tags */ $metas = Meta::getMetaByPage($page_name, $id_lang); - $ret['meta_title'] = (isset($metas['title']) and $metas['title']) ? $metas['title'] . ' - ' . Configuration::get('PS_SHOP_NAME') : Configuration::get('PS_SHOP_NAME'); - $ret['meta_description'] = (isset($metas['description']) and $metas['description']) ? $metas['description'] : ''; - $ret['meta_keywords'] = (isset($metas['keywords']) and $metas['keywords']) ? $metas['keywords'] : ''; + $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? $metas['title'] . ' - ' . Configuration::get('PS_SHOP_NAME') : Configuration::get('PS_SHOP_NAME'); + $ret['meta_description'] = (isset($metas['description']) && $metas['description']) ? $metas['description'] : ''; + $ret['meta_keywords'] = (isset($metas['keywords']) && $metas['keywords']) ? $metas['keywords'] : ''; return $ret; } @@ -926,10 +926,10 @@ public static function getPath($id_category, $path = '', $linkOntheLastItem = fa $nCategories = (int) sizeof($categories); foreach ($categories as $category) { $fullPath .= - (($n < $nCategories or $linkOntheLastItem) ? '' : '') . + (($n < $nCategories || $linkOntheLastItem) ? '' : '') . htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8') . - (($n < $nCategories or $linkOntheLastItem) ? '' : '') . - (($n++ != $nCategories or !empty($path)) ? '' . $pipe . '' : ''); + (($n < $nCategories || $linkOntheLastItem) ? '' : '') . + (($n++ != $nCategories || !empty($path)) ? '' . $pipe . '' : ''); } return $fullPath . $path; @@ -1023,13 +1023,13 @@ public static function getOrdersTotal() public static function historyc_l($key, $translations) { global $cookie; - if (!$translations or !is_array($translations)) { + if (!$translations || !is_array($translations)) { die(self::displayError()); } $iso = strtoupper(Language::getIsoById($cookie->id_lang)); $lang = key_exists($iso, $translations) ? $translations[$iso] : false; - return ($lang and is_array($lang) and key_exists($key, $lang)) ? stripslashes($lang[$key]) : $key; + return ($lang && is_array($lang) && key_exists($key, $lang)) ? stripslashes($lang[$key]) : $key; } /** @@ -1264,7 +1264,7 @@ public static function ucfirst($str) public static function orderbyPrice(&$array, $orderWay) { foreach ($array as &$row) { - $row['price_tmp'] = Product::getPriceStatic($row['id_product'], true, ((isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) ($row['id_product_attribute']) : null), 2); + $row['price_tmp'] = Product::getPriceStatic($row['id_product'], true, ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int) ($row['id_product_attribute']) : null), 2); } if (strtolower($orderWay) == 'desc') { uasort($array, 'cmpPriceDesc'); @@ -1287,7 +1287,7 @@ public static function iconv($from, $to, $string) public static function isEmpty($field) { - return $field === '' or $field === null; + return $field === '' || $field === null; } /** @@ -1398,7 +1398,7 @@ public static function shouldUseFopen($url) public static function file_get_contents($url, $use_include_path = false, $stream_context = null, $curl_timeout = 5) { - if (!extension_loaded('openssl') and strpos('https://', $url) === true) { + if (!extension_loaded('openssl') && strpos('https://', $url) === true) { $url = str_replace('https', 'http', $url); } if ($stream_context == null && preg_match('/^https?:\/\//', $url)) { @@ -1878,7 +1878,7 @@ public static function getMediaServer($filename) } } - if (self::$_cache_nb_media_servers and ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1))) { + if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1))) { return constant('_MEDIA_SERVER_' . $id_media_server . '_'); } @@ -1945,7 +1945,7 @@ public static function generateHtaccess($path, $rewrite_settings, $cache_control $tab['RewriteRule']['content']['^content/category/([0-9]+)\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms_category=$1 [QSA,L]'; // Compatibility with the old URLs - if (!Configuration::get('PS_INSTALL_VERSION') or version_compare(Configuration::get('PS_INSTALL_VERSION'), '1.4.0.7') == -1) { + if (!Configuration::get('PS_INSTALL_VERSION') || version_compare(Configuration::get('PS_INSTALL_VERSION'), '1.4.0.7') == -1) { // This is a nasty copy/paste of the previous links, but with "lang-en" instead of "en" // Do not update it when you add something in the one at the top, it's only for the old links $tab['RewriteRule']['content']['^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html'] = 'product.php?id_product=$3&isolang=$1 [QSA,L]'; @@ -1961,7 +1961,7 @@ public static function generateHtaccess($path, $rewrite_settings, $cache_control if ($multilang) { foreach (Language::getLanguages() as $language) { foreach (Meta::getMetasByIdLang($language['id_lang']) as $key => $meta) { - if (!empty($meta['url_rewrite']) and Validate::isLinkRewrite($meta['url_rewrite'])) { + if (!empty($meta['url_rewrite']) && Validate::isLinkRewrite($meta['url_rewrite'])) { $tab['RewriteRule']['content']['^' . $language['iso_code'] . '/' . $meta['url_rewrite'] . '$'] = $meta['page'] . '.php?isolang=' . $language['iso_code'] . ' [QSA,L]'; } elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') { $tab['RewriteRule']['content']['^' . $language['iso_code'] . '/' . $default_meta[$key]['url_rewrite'] . '$'] = $default_meta[$key]['page'] . '.php?isolang=' . $language['iso_code'] . ' [QSA,L]'; @@ -2111,7 +2111,7 @@ public static function enableCache($level = 1) if (!Configuration::get('PS_SMARTY_CACHE')) { return; } - if ($smarty->force_compile == 0 and $smarty->caching == $level) { + if ($smarty->force_compile == 0 && $smarty->caching == $level) { return; } self::$_forceCompile = (int) ($smarty->force_compile); @@ -2136,7 +2136,7 @@ public static function isCallable($function) { $disabled = explode(',', ini_get('disable_functions')); - return !in_array($function, $disabled) and is_callable($function); + return !in_array($function, $disabled) && is_callable($function); } public static function pRegexp($s, $delim) @@ -2249,7 +2249,7 @@ public static function ZipExtract($fromFile, $toDir) } if (class_exists('ZipArchive', false)) { $zip = new ZipArchive(); - if ($zip->open($fromFile) === true and $zip->extractTo($toDir) and $zip->close()) { + if ($zip->open($fromFile) === true && $zip->extractTo($toDir) && $zip->close()) { return true; } diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php index 9f74366fc..c120daf92 100644 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php +++ b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php @@ -113,8 +113,8 @@ protected function initConstants() // setting the memory limit to 128M only if current is lower $memory_limit = ini_get('memory_limit'); if ((substr($memory_limit, -1) != 'G') - && ((substr($memory_limit, -1) == 'M' and substr($memory_limit, 0, -1) < 512) - || is_numeric($memory_limit) and (intval($memory_limit) < 131072)) + && ((substr($memory_limit, -1) == 'M' && substr($memory_limit, 0, -1) < 512) + || is_numeric($memory_limit) && (intval($memory_limit) < 131072)) ) { @ini_set('memory_limit', '512M'); } @@ -164,7 +164,7 @@ protected function initConstants() } // if _PS_ROOT_DIR_ is defined, use it instead of "guessing" the module dir. - if (defined('_PS_ROOT_DIR_') and !defined('_PS_MODULE_DIR_')) { + if (defined('_PS_ROOT_DIR_') && !defined('_PS_MODULE_DIR_')) { define('_PS_MODULE_DIR_', _PS_ROOT_DIR_ . '/modules/'); } elseif (!defined('_PS_MODULE_DIR_')) { define('_PS_MODULE_DIR_', INSTALL_PATH . '/../modules/'); @@ -515,7 +515,7 @@ protected function generateHtaccess() if (file_exists(_PS_ROOT_DIR_ . '/classes/Tools.php')) { require_once _PS_ROOT_DIR_ . '/classes/Tools.php'; } - if (!class_exists('Tools2', false) and class_exists('ToolsCore')) { + if (!class_exists('Tools2', false) && class_exists('ToolsCore')) { eval('class Tools2 extends ToolsCore{}'); } @@ -535,105 +535,105 @@ protected function generateHtaccess() if (file_exists(_PS_ROOT_DIR_ . '/classes/ObjectModel.php')) { require_once _PS_ROOT_DIR_ . '/classes/ObjectModel.php'; } - if (!class_exists('ObjectModel', false) and class_exists('ObjectModelCore')) { + if (!class_exists('ObjectModel', false) && class_exists('ObjectModelCore')) { eval('abstract class ObjectModel extends ObjectModelCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Configuration.php')) { require_once _PS_ROOT_DIR_ . '/classes/Configuration.php'; } - if (!class_exists('Configuration', false) and class_exists('ConfigurationCore')) { + if (!class_exists('Configuration', false) && class_exists('ConfigurationCore')) { eval('class Configuration extends ConfigurationCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/cache/Cache.php')) { require_once _PS_ROOT_DIR_ . '/classes/cache/Cache.php'; } - if (!class_exists('Cache', false) and class_exists('CacheCore')) { + if (!class_exists('Cache', false) && class_exists('CacheCore')) { eval('abstract class Cache extends CacheCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/PrestaShopCollection.php')) { require_once _PS_ROOT_DIR_ . '/classes/PrestaShopCollection.php'; } - if (!class_exists('PrestaShopCollection', false) and class_exists('PrestaShopCollectionCore')) { + if (!class_exists('PrestaShopCollection', false) && class_exists('PrestaShopCollectionCore')) { eval('class PrestaShopCollection extends PrestaShopCollectionCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/shop/ShopUrl.php')) { require_once _PS_ROOT_DIR_ . '/classes/shop/ShopUrl.php'; } - if (!class_exists('ShopUrl', false) and class_exists('ShopUrlCore')) { + if (!class_exists('ShopUrl', false) && class_exists('ShopUrlCore')) { eval('class ShopUrl extends ShopUrlCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/shop/Shop.php')) { require_once _PS_ROOT_DIR_ . '/classes/shop/Shop.php'; } - if (!class_exists('Shop', false) and class_exists('ShopCore')) { + if (!class_exists('Shop', false) && class_exists('ShopCore')) { eval('class Shop extends ShopCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Translate.php')) { require_once _PS_ROOT_DIR_ . '/classes/Translate.php'; } - if (!class_exists('Translate', false) and class_exists('TranslateCore')) { + if (!class_exists('Translate', false) && class_exists('TranslateCore')) { eval('class Translate extends TranslateCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/module/Module.php')) { require_once _PS_ROOT_DIR_ . '/classes/module/Module.php'; } - if (!class_exists('Module', false) and class_exists('ModuleCore')) { + if (!class_exists('Module', false) && class_exists('ModuleCore')) { eval('class Module extends ModuleCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Validate.php')) { require_once _PS_ROOT_DIR_ . '/classes/Validate.php'; } - if (!class_exists('Validate', false) and class_exists('ValidateCore')) { + if (!class_exists('Validate', false) && class_exists('ValidateCore')) { eval('class Validate extends ValidateCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Language.php')) { require_once _PS_ROOT_DIR_ . '/classes/Language.php'; } - if (!class_exists('Language', false) and class_exists('LanguageCore')) { + if (!class_exists('Language', false) && class_exists('LanguageCore')) { eval('class Language extends LanguageCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Tab.php')) { require_once _PS_ROOT_DIR_ . '/classes/Tab.php'; } - if (!class_exists('Tab', false) and class_exists('TabCore')) { + if (!class_exists('Tab', false) && class_exists('TabCore')) { eval('class Tab extends TabCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Dispatcher.php')) { require_once _PS_ROOT_DIR_ . '/classes/Dispatcher.php'; } - if (!class_exists('Dispatcher', false) and class_exists('DispatcherCore')) { + if (!class_exists('Dispatcher', false) && class_exists('DispatcherCore')) { eval('class Dispatcher extends DispatcherCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Hook.php')) { require_once _PS_ROOT_DIR_ . '/classes/Hook.php'; } - if (!class_exists('Hook', false) and class_exists('HookCore')) { + if (!class_exists('Hook', false) && class_exists('HookCore')) { eval('class Hook extends HookCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Context.php')) { require_once _PS_ROOT_DIR_ . '/classes/Context.php'; } - if (!class_exists('Context', false) and class_exists('ContextCore')) { + if (!class_exists('Context', false) && class_exists('ContextCore')) { eval('class Context extends ContextCore{}'); } if (file_exists(_PS_ROOT_DIR_ . '/classes/Group.php')) { require_once _PS_ROOT_DIR_ . '/classes/Group.php'; } - if (!class_exists('Group', false) and class_exists('GroupCore')) { + if (!class_exists('Group', false) && class_exists('GroupCore')) { eval('class Group extends GroupCore{}'); } diff --git a/functions.php b/functions.php index 705ec6f75..43fe81686 100755 --- a/functions.php +++ b/functions.php @@ -34,18 +34,18 @@ function rewriteSettingsFile($baseUrls = null, $theme = null, $arrayDB = null) { $defines = array(); - $defines['__PS_BASE_URI__'] = ($baseUrls and $baseUrls['__PS_BASE_URI__']) ? $baseUrls['__PS_BASE_URI__'] : __PS_BASE_URI__; - $defines['_MEDIA_SERVER_1_'] = ($baseUrls and isset($baseUrls['_MEDIA_SERVER_1_'])) ? $baseUrls['_MEDIA_SERVER_1_'] : _MEDIA_SERVER_1_; + $defines['__PS_BASE_URI__'] = ($baseUrls && $baseUrls['__PS_BASE_URI__']) ? $baseUrls['__PS_BASE_URI__'] : __PS_BASE_URI__; + $defines['_MEDIA_SERVER_1_'] = ($baseUrls && isset($baseUrls['_MEDIA_SERVER_1_'])) ? $baseUrls['_MEDIA_SERVER_1_'] : _MEDIA_SERVER_1_; $defines['_PS_CACHING_SYSTEM_'] = _PS_CACHING_SYSTEM_; $defines['_PS_CACHE_ENABLED_'] = _PS_CACHE_ENABLED_; $defines['_THEME_NAME_'] = $theme ? $theme : _THEME_NAME_; - $defines['_DB_NAME_'] = (($arrayDB and isset($arrayDB['_DB_NAME_'])) ? $arrayDB['_DB_NAME_'] : _DB_NAME_); - $defines['_MYSQL_ENGINE_'] = (($arrayDB and isset($arrayDB['_MYSQL_ENGINE_'])) ? $arrayDB['_MYSQL_ENGINE_'] : _MYSQL_ENGINE_); - $defines['_DB_SERVER_'] = (($arrayDB and isset($arrayDB['_DB_SERVER_'])) ? $arrayDB['_DB_SERVER_'] : _DB_SERVER_); - $defines['_DB_USER_'] = (($arrayDB and isset($arrayDB['_DB_USER_'])) ? $arrayDB['_DB_USER_'] : _DB_USER_); - $defines['_DB_PREFIX_'] = (($arrayDB and isset($arrayDB['_DB_PREFIX_'])) ? $arrayDB['_DB_PREFIX_'] : _DB_PREFIX_); - $defines['_DB_PASSWD_'] = (($arrayDB and isset($arrayDB['_DB_PASSWD_'])) ? $arrayDB['_DB_PASSWD_'] : _DB_PASSWD_); - $defines['_DB_TYPE_'] = (($arrayDB and isset($arrayDB['_DB_TYPE_'])) ? $arrayDB['_DB_TYPE_'] : _DB_TYPE_); + $defines['_DB_NAME_'] = (($arrayDB && isset($arrayDB['_DB_NAME_'])) ? $arrayDB['_DB_NAME_'] : _DB_NAME_); + $defines['_MYSQL_ENGINE_'] = (($arrayDB && isset($arrayDB['_MYSQL_ENGINE_'])) ? $arrayDB['_MYSQL_ENGINE_'] : _MYSQL_ENGINE_); + $defines['_DB_SERVER_'] = (($arrayDB && isset($arrayDB['_DB_SERVER_'])) ? $arrayDB['_DB_SERVER_'] : _DB_SERVER_); + $defines['_DB_USER_'] = (($arrayDB && isset($arrayDB['_DB_USER_'])) ? $arrayDB['_DB_USER_'] : _DB_USER_); + $defines['_DB_PREFIX_'] = (($arrayDB && isset($arrayDB['_DB_PREFIX_'])) ? $arrayDB['_DB_PREFIX_'] : _DB_PREFIX_); + $defines['_DB_PASSWD_'] = (($arrayDB && isset($arrayDB['_DB_PASSWD_'])) ? $arrayDB['_DB_PASSWD_'] : _DB_PASSWD_); + $defines['_DB_TYPE_'] = (($arrayDB && isset($arrayDB['_DB_TYPE_'])) ? $arrayDB['_DB_TYPE_'] : _DB_TYPE_); $defines['_COOKIE_KEY_'] = addslashes(_COOKIE_KEY_); $defines['_COOKIE_IV_'] = addslashes(_COOKIE_IV_); if (defined('_RIJNDAEL_KEY_')) { @@ -120,7 +120,7 @@ function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryT ($n < $nCategories ? '' : '') . (!empty($highlight) ? str_ireplace($highlight, '' . htmlentities($highlight, ENT_NOQUOTES, 'UTF-8') . '', $category['name']) : $category['name']) . ($n < $nCategories ? '' : '') . - (($n++ != $nCategories or !empty($path)) ? ' > ' : ''); + (($n++ != $nCategories || !empty($path)) ? ' > ' : ''); } return $fullPath . $path; @@ -202,13 +202,13 @@ function checkingTab($tab) return false; } - if ($row['module'] and file_exists(_PS_MODULE_DIR_ . '/' . $row['module'] . '/' . $tab . '.php')) { + if ($row['module'] && file_exists(_PS_MODULE_DIR_ . '/' . $row['module'] . '/' . $tab . '.php')) { include_once _PS_MODULE_DIR_ . '/' . $row['module'] . '/' . $tab . '.php'; } elseif (file_exists(PS_ADMIN_DIR . '/tabs/' . $tab . '.php')) { include_once PS_ADMIN_DIR . '/tabs/' . $tab . '.php'; } - if (!class_exists($tab, false) or !$row['id_tab']) { + if (!class_exists($tab, false) || !$row['id_tab']) { echo Tools14::displayError('Tab file cannot be found.'); return false; From 5238f8cfce25960f73b851883b6b876cc0df6239 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:24:06 +0100 Subject: [PATCH 08/35] Combine consecutive issets --- classes/TaskRunner/Miscellaneous/UpdateConfig.php | 2 +- classes/TaskRunner/Upgrade/BackupDb.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/TaskRunner/Miscellaneous/UpdateConfig.php b/classes/TaskRunner/Miscellaneous/UpdateConfig.php index 2cc68da89..1e762435f 100644 --- a/classes/TaskRunner/Miscellaneous/UpdateConfig.php +++ b/classes/TaskRunner/Miscellaneous/UpdateConfig.php @@ -51,7 +51,7 @@ public function run() $config['channel'] = $request['channel']; $config['archive.filename'] = Upgrader::DEFAULT_FILENAME; } - if (isset($request['private_release_link']) && isset($request['private_release_md5'])) { + if (isset($request['private_release_link'], $request['private_release_md5'])) { $config['channel'] = 'private'; $config['private_release_link'] = $request['private_release_link']; $config['private_release_md5'] = $request['private_release_md5']; diff --git a/classes/TaskRunner/Upgrade/BackupDb.php b/classes/TaskRunner/Upgrade/BackupDb.php index dbd92b778..8c7158f08 100644 --- a/classes/TaskRunner/Upgrade/BackupDb.php +++ b/classes/TaskRunner/Upgrade/BackupDb.php @@ -159,8 +159,8 @@ public function run() $schema = $this->container->getDb()->executeS('SHOW CREATE TABLE `' . $table . '`', true, false); if (count($schema) != 1 || - !((isset($schema[0]['Table']) && isset($schema[0]['Create Table'])) - || (isset($schema[0]['View']) && isset($schema[0]['Create View'])))) { + !(isset($schema[0]['Table'], $schema[0]['Create Table']) + || isset($schema[0]['View'], $schema[0]['Create View']))) { fclose($fp); if (file_exists($backupfile)) { unlink($backupfile); From fa8a37596a508ff2fe5c8b0289590d944435d19e Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:24:39 +0100 Subject: [PATCH 09/35] Method chaining indentation --- classes/UpgradePage.php | 2 +- tests/CoreUpgraderTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/UpgradePage.php b/classes/UpgradePage.php index 29f8197b3..d211b9cb1 100644 --- a/classes/UpgradePage.php +++ b/classes/UpgradePage.php @@ -258,7 +258,7 @@ private function getUpgradeOptionsForm() $formRenderer = new FormRenderer($this->config, $this->twig, $this->translator); return (new UpgradeOptionsForm($this->translator, $formRenderer)) - ->render(); + ->render(); } /** diff --git a/tests/CoreUpgraderTest.php b/tests/CoreUpgraderTest.php index 5858272c0..d4d32573c 100644 --- a/tests/CoreUpgraderTest.php +++ b/tests/CoreUpgraderTest.php @@ -38,8 +38,8 @@ protected function setUp() parent::setUp(); $stub = $this->getMockBuilder(UpgradeContainer::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $this->coreUpgrader = new CoreUpgrader17($stub, new LegacyLogger()); } From c8bb8c3930d7267ec416820054e53a5178dfb8e5 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:26:43 +0100 Subject: [PATCH 10/35] Replace is_null with null !== --- classes/PrestashopConfiguration.php | 2 +- classes/TaskRunner/Upgrade/BackupDb.php | 2 +- classes/Tools14.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/PrestashopConfiguration.php b/classes/PrestashopConfiguration.php index f252703ac..f9d08c7be 100644 --- a/classes/PrestashopConfiguration.php +++ b/classes/PrestashopConfiguration.php @@ -79,7 +79,7 @@ public function getCompliancyResults() */ public function getModuleVersion() { - if (!is_null($this->moduleVersion)) { + if (null !== $this->moduleVersion) { return $this->moduleVersion; } diff --git a/classes/TaskRunner/Upgrade/BackupDb.php b/classes/TaskRunner/Upgrade/BackupDb.php index dbd92b778..dea80f217 100644 --- a/classes/TaskRunner/Upgrade/BackupDb.php +++ b/classes/TaskRunner/Upgrade/BackupDb.php @@ -91,7 +91,7 @@ public function run() // MAIN BACKUP LOOP // $written = 0; do { - if (!is_null($this->container->getState()->getBackupTable())) { + if (null !== $this->container->getState()->getBackupTable()) { // only insert (schema already done) $table = $this->container->getState()->getBackupTable(); $lines = $this->container->getState()->getBackupLines(); diff --git a/classes/Tools14.php b/classes/Tools14.php index d9b0ffd2b..c7af6b192 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -127,7 +127,7 @@ public static function redirectAdmin($url) */ public static function getProtocol($use_ssl = null) { - return !is_null($use_ssl) && $use_ssl ? 'https://' : 'http://'; + return null !== $use_ssl && $use_ssl ? 'https://' : 'http://'; } /** @@ -2291,14 +2291,14 @@ public static function getProductsOrder($type, $value = null, $prefix = false) } } - $value = (is_null($value) || $value === false || $value === '') ? (int) Configuration::get('PS_PRODUCTS_ORDER_BY') : $value; + $value = (null === $value || $value === false || $value === '') ? (int) Configuration::get('PS_PRODUCTS_ORDER_BY') : $value; $list = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity'); return $orderByPrefix . ((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position')); break; case 'way': - $value = (is_null($value) || $value === false || $value === '') ? (int) Configuration::get('PS_PRODUCTS_ORDER_WAY') : $value; + $value = (null === $value || $value === false || $value === '') ? (int) Configuration::get('PS_PRODUCTS_ORDER_WAY') : $value; $list = array(0 => 'asc', 1 => 'desc'); return (isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'asc'); @@ -2450,7 +2450,7 @@ public static function nl2br($str) */ public static function copy($source, $destination, $stream_context = null) { - if (is_null($stream_context) && !preg_match('/^https?:\/\//', $source)) { + if (null === $stream_context && !preg_match('/^https?:\/\//', $source)) { return @copy($source, $destination); } From c5103db4775158bdb2b0bc792d3fdadee21881d8 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:33:18 +0100 Subject: [PATCH 11/35] No extra consecutive blank lines --- tests/FilesystemAdapterTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/FilesystemAdapterTest.php b/tests/FilesystemAdapterTest.php index 8f15f98ba..e84c10c4e 100644 --- a/tests/FilesystemAdapterTest.php +++ b/tests/FilesystemAdapterTest.php @@ -125,7 +125,7 @@ public function testRandomFolderIsNotAPrestashopRelease() public function testTempFolderIsAPrestashopRelease() { // Create temp folder and fill it with the needed files - $folder = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'PSA' . rand(100, 2000); + $folder = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'PSA' . mt_rand(100, 2000); $this->fillFolderWithPsAssets($folder); $this->assertTrue( @@ -139,7 +139,7 @@ public function testTempFolderIsAPrestashopRelease() public function testTempFolderIsNotAPrestashopReleaseAfterChanges() { // Create temp folder and fill it with the needed files - $folder = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'PSA' . rand(100, 2000); + $folder = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'PSA' . mt_rand(100, 2000); $this->fillFolderWithPsAssets($folder); rmdir($folder . DIRECTORY_SEPARATOR . 'classes'); touch($folder . DIRECTORY_SEPARATOR . 'classes'); From efd9ccfbdd497e98bdeb83e11bf3fe5e298cef68 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:27:16 +0100 Subject: [PATCH 12/35] PHP unit dedicate assert --- tests/ErrorHandlerTest.php | 6 +++--- tests/LegacyLoggerTest.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/ErrorHandlerTest.php b/tests/ErrorHandlerTest.php index 7f603c2cc..186c30737 100644 --- a/tests/ErrorHandlerTest.php +++ b/tests/ErrorHandlerTest.php @@ -53,7 +53,7 @@ public function testCheckExceptionAndContent() $this->errorHandler->exceptionHandler($exception); $errors = $this->logger->getErrors(); - $this->assertEquals(1, count($errors)); + $this->assertCount(1, $errors); $this->assertContains('[INTERNAL] ' . __FILE__ . ' line ' . $line . ' - Exception: ERMAGHERD', end($errors)); } @@ -62,8 +62,8 @@ public function testWarningInErrorHandler() $line = __LINE__; $this->errorHandler->errorHandler(E_WARNING, 'Trololo', __FILE__, $line); $msgs = $this->logger->getInfos(); - $this->assertEquals(0, count($this->logger->getErrors())); - $this->assertEquals(1, count($msgs)); + $this->assertCount(0, $this->logger->getErrors()); + $this->assertCount(1, $msgs); $this->assertEquals(end($msgs), '[INTERNAL] ' . __FILE__ . ' line ' . $line . ' - Trololo'); } diff --git a/tests/LegacyLoggerTest.php b/tests/LegacyLoggerTest.php index 9bacd0f70..c7dfb13a3 100644 --- a/tests/LegacyLoggerTest.php +++ b/tests/LegacyLoggerTest.php @@ -46,7 +46,7 @@ public function testSeveralLastInfoAreRegistered() $this->assertSame('Good bye', $logger->getLastInfo()); $infos = $logger->getInfos(); $this->assertSame('Hello', end($infos)); - $this->assertSame(1, count($infos)); + $this->assertCount(1, $infos); } public function testErrorIsRegistered() @@ -55,8 +55,8 @@ public function testErrorIsRegistered() $logger->log(LegacyLogger::CRITICAL, 'Ach!!!'); $errors = $logger->getErrors(); - $this->assertSame(1, count($errors)); - $this->assertSame(0, count($logger->getInfos())); + $this->assertCount(1, $errors); + $this->assertCount(0, $logger->getInfos()); $this->assertSame('Ach!!!', end($errors)); } @@ -66,8 +66,8 @@ public function testMessageIsRegistered() $logger->log(LegacyLogger::DEBUG, 'Some stuff happened'); $messages = $logger->getInfos(); - $this->assertSame(1, count($messages)); - $this->assertSame(0, count($logger->getErrors())); + $this->assertCount(1, $messages); + $this->assertCount(0, $logger->getErrors()); $this->assertSame('Some stuff happened', end($messages)); } } From 15b151df2913e4a6c31add215badc5e19f51faae Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:24:47 +0100 Subject: [PATCH 13/35] Multiline whitespace before semicolons --- classes/UpgradeSelfCheck.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/classes/UpgradeSelfCheck.php b/classes/UpgradeSelfCheck.php index 4c494b720..fc035fe60 100644 --- a/classes/UpgradeSelfCheck.php +++ b/classes/UpgradeSelfCheck.php @@ -234,8 +234,7 @@ public function isOkForUpgrade() && $this->isShopDeactivated() && $this->isCacheDisabled() && $this->isModuleVersionLatest() - && $this->isPrestaShopReady() - ; + && $this->isPrestaShopReady(); } /** @@ -278,8 +277,7 @@ private function checkShopIsDeactivated() { return !Configuration::get('PS_SHOP_ENABLE') - || (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], array('127.0.0.1', 'localhost'))) - ; + || (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], array('127.0.0.1', 'localhost'))); } /** From d3299b07bc5a778daeb280d3a285355ac77d4f4b Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:27:08 +0100 Subject: [PATCH 14/35] php unit construct --- tests/FilesystemAdapterTest.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/FilesystemAdapterTest.php b/tests/FilesystemAdapterTest.php index 8f15f98ba..afa9473fd 100644 --- a/tests/FilesystemAdapterTest.php +++ b/tests/FilesystemAdapterTest.php @@ -46,8 +46,7 @@ protected function setUp() */ public function testFileIsIgnored($file, $fullpath, $process) { - $this->assertSame( - true, + $this->assertTrue( $this->filesystemAdapter->isFileSkipped( $file, $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . $fullpath, @@ -62,8 +61,7 @@ public function testFileIsIgnored($file, $fullpath, $process) */ public function testFileFromReleaseIsIgnored($file, $fullpath, $process) { - $this->assertSame( - true, + $this->assertTrue( $this->filesystemAdapter->isFileSkipped( $file, $this->container->getProperty(UpgradeContainer::LATEST_PATH).$fullpath, @@ -77,8 +75,7 @@ public function testFileFromReleaseIsIgnored($file, $fullpath, $process) */ public function testFileIsNotIgnored($file, $fullpath, $process) { - $this->assertSame( - false, + $this->assertFalse( $this->filesystemAdapter->isFileSkipped( $file, $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . $fullpath, From 84046a1f17ecea7f572f7e76acf837f9f81e4f37 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:28:08 +0100 Subject: [PATCH 15/35] PHP unit set up tear down visibility --- tests/CookieTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CookieTest.php b/tests/CookieTest.php index afd2e0a95..175622695 100644 --- a/tests/CookieTest.php +++ b/tests/CookieTest.php @@ -33,7 +33,7 @@ class CookieTest extends TestCase private $cookie; - public function setUp() + protected function setUp() { parent::setUp(); $this->cookie = new Cookie('admin', sys_get_temp_dir()); From ba7ee8e1792a1bd3d72a758c0c6aa2c0ffa84ef3 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:29:09 +0100 Subject: [PATCH 16/35] Modernize types casting --- classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php index c120daf92..f5dc56863 100644 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php +++ b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php @@ -114,7 +114,7 @@ protected function initConstants() $memory_limit = ini_get('memory_limit'); if ((substr($memory_limit, -1) != 'G') && ((substr($memory_limit, -1) == 'M' && substr($memory_limit, 0, -1) < 512) - || is_numeric($memory_limit) && (intval($memory_limit) < 131072)) + || is_numeric($memory_limit) && ((int) $memory_limit < 131072)) ) { @ini_set('memory_limit', '512M'); } From a0b90c7848fe6bab8961de3ce3471abe0faf8ff8 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:29:39 +0100 Subject: [PATCH 17/35] One concat space --- classes/UpgradeTools/FilesystemAdapter.php | 2 +- tests/FilesystemAdapterTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/UpgradeTools/FilesystemAdapter.php b/classes/UpgradeTools/FilesystemAdapter.php index 8dab5faa4..f00aca9a1 100644 --- a/classes/UpgradeTools/FilesystemAdapter.php +++ b/classes/UpgradeTools/FilesystemAdapter.php @@ -227,7 +227,7 @@ public function isFileSkipped($file, $fullpath, $way = 'backup', $temporaryWorks } foreach ($ignoreList as $path) { - $path = str_replace(DIRECTORY_SEPARATOR.'admin', DIRECTORY_SEPARATOR.$this->adminSubDir, $path); + $path = str_replace(DIRECTORY_SEPARATOR . 'admin', DIRECTORY_SEPARATOR . $this->adminSubDir, $path); if ($fullpath === $rootpath . $path) { return true; } diff --git a/tests/FilesystemAdapterTest.php b/tests/FilesystemAdapterTest.php index 8f15f98ba..a5cc94cd3 100644 --- a/tests/FilesystemAdapterTest.php +++ b/tests/FilesystemAdapterTest.php @@ -66,7 +66,7 @@ public function testFileFromReleaseIsIgnored($file, $fullpath, $process) true, $this->filesystemAdapter->isFileSkipped( $file, - $this->container->getProperty(UpgradeContainer::LATEST_PATH).$fullpath, + $this->container->getProperty(UpgradeContainer::LATEST_PATH) . $fullpath, $process, $this->container->getProperty(UpgradeContainer::LATEST_PATH) )); From 8e79206aaea56233b380bac4f6c6cd7307e73982 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:23:17 +0100 Subject: [PATCH 18/35] Replace tabs with spaces --- AdminSelfUpgrade.php | 10 +++++----- functions.php | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index 8ecd30c1a..85f34348b 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -19,11 +19,11 @@ * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * -* @author PrestaShop SA -* @copyright 2007-2016 PrestaShop SA -* @version Release: $Revision: 11834 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @version Release: $Revision: 11834 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA */ use PrestaShop\Module\AutoUpgrade\AjaxResponse; diff --git a/functions.php b/functions.php index 43fe81686..b5f6a50fe 100755 --- a/functions.php +++ b/functions.php @@ -97,19 +97,19 @@ function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryT global $cookie; if ($categoryType == 'catalog') { - $category = Db::getInstance()->getRow(' - SELECT id_category, level_depth, nleft, nright - FROM ' . _DB_PREFIX_ . 'category - WHERE id_category = ' . (int) $id_category); + $category = Db::getInstance()->getRow(' + SELECT id_category, level_depth, nleft, nright + FROM ' . _DB_PREFIX_ . 'category + WHERE id_category = ' . (int) $id_category); if (isset($category['id_category'])) { - $categories = Db::getInstance()->ExecuteS(' - SELECT c.id_category, cl.name, cl.link_rewrite - FROM ' . _DB_PREFIX_ . 'category c - LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (cl.id_category = c.id_category) - WHERE c.nleft <= ' . (int) $category['nleft'] . ' AND c.nright >= ' . (int) $category['nright'] . ' AND cl.id_lang = ' . (int) ($cookie->id_lang) . ' - ORDER BY c.level_depth ASC - LIMIT ' . (int) ($category['level_depth'] + 1)); + $categories = Db::getInstance()->ExecuteS(' + SELECT c.id_category, cl.name, cl.link_rewrite + FROM ' . _DB_PREFIX_ . 'category c + LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (cl.id_category = c.id_category) + WHERE c.nleft <= ' . (int) $category['nleft'] . ' AND c.nright >= ' . (int) $category['nright'] . ' AND cl.id_lang = ' . (int) ($cookie->id_lang) . ' + ORDER BY c.level_depth ASC + LIMIT ' . (int) ($category['level_depth'] + 1)); $fullPath = ''; $n = 1; @@ -132,14 +132,14 @@ function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryT } $name = ($highlight != null) ? str_ireplace($highlight, '' . $highlight . '', CMSCategory::hideCMSCategoryPosition($category->name)) : CMSCategory::hideCMSCategoryPosition($category->name); - $edit = ' - Modify '; + $edit = ' + Modify '; if ($category->id == 1) { - $edit = ' - Home '; + $edit = ' + Home '; } - $path = $edit . ' - ' . $name . ' > ' . $path; + $path = $edit . ' + ' . $name . ' > ' . $path; if ($category->id == 1) { return substr($path, 0, strlen($path) - 3); } From 8b0c99743a7ac45373630b3aff198dc842999ca1 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:23:32 +0100 Subject: [PATCH 19/35] Blank line before statement --- autoupgrade.php | 2 ++ classes/TaskRunner/Upgrade/UpgradeDb.php | 1 + 2 files changed, 3 insertions(+) diff --git a/autoupgrade.php b/autoupgrade.php index 6d1b4cdef..c0d3f09ea 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -57,6 +57,7 @@ public function install() { if (50600 > PHP_VERSION_ID) { $this->_errors[] = $this->trans('This version of 1-click upgrade requires PHP 5.6 to work properly. Please upgrade your server configuration.', array(), 'Modules.Autoupgrade.Admin'); + return false; } @@ -204,6 +205,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/classes/UpgradeTools/Translator.php'; $translator = new \PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator(__CLASS__); + return $translator->trans($id, $parameters, $domain, $locale); } } diff --git a/classes/TaskRunner/Upgrade/UpgradeDb.php b/classes/TaskRunner/Upgrade/UpgradeDb.php index 19ce73dfa..f2bd1d848 100644 --- a/classes/TaskRunner/Upgrade/UpgradeDb.php +++ b/classes/TaskRunner/Upgrade/UpgradeDb.php @@ -54,6 +54,7 @@ public function run() $this->logger->info($this->translator->trans('Database upgraded. Now upgrading your Addons modules...', array(), 'Modules.Autoupgrade.Admin')); $this->container->getSymfonyAdapter()->clearMigrationCache(); + return true; } From c092c7ddad0ad5373f9b4a209b2db9d3b039ff68 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:23:39 +0100 Subject: [PATCH 20/35] Ekstra blank line --- classes/TaskRunner/Upgrade/UpgradeComplete.php | 1 - 1 file changed, 1 deletion(-) diff --git a/classes/TaskRunner/Upgrade/UpgradeComplete.php b/classes/TaskRunner/Upgrade/UpgradeComplete.php index b02f5fe69..e049173ea 100644 --- a/classes/TaskRunner/Upgrade/UpgradeComplete.php +++ b/classes/TaskRunner/Upgrade/UpgradeComplete.php @@ -30,7 +30,6 @@ use PrestaShop\Module\AutoUpgrade\TaskRunner\AbstractTask; use PrestaShop\Module\AutoUpgrade\UpgradeTools\FilesystemAdapter; use PrestaShop\Module\AutoUpgrade\UpgradeContainer; - use Configuration; /** From c4602690d079c618467bf15425614b93972b5c60 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:28:47 +0100 Subject: [PATCH 21/35] No null property initialization --- AdminSelfUpgrade.php | 22 +++++++++++----------- classes/Log/LegacyLogger.php | 2 +- classes/PrestashopConfiguration.php | 2 +- classes/State.php | 22 +++++++++++----------- classes/UpgradeTools/ModuleAdapter.php | 2 +- classes/Upgrader.php | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index 8ecd30c1a..57ecc899b 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -55,11 +55,11 @@ class AdminSelfUpgrade extends AdminController /** * Initialized in initPath(). */ - public $autoupgradePath = null; - public $downloadPath = null; - public $backupPath = null; - public $latestPath = null; - public $tmpPath = null; + public $autoupgradePath; + public $downloadPath; + public $backupPath; + public $latestPath; + public $tmpPath; /** * autoupgradeDir. @@ -71,12 +71,12 @@ class AdminSelfUpgrade extends AdminController public $prodRootDir = ''; public $adminDir = ''; - public $keepImages = null; - public $updateDefaultTheme = null; - public $changeToDefaultTheme = null; - public $keepMails = null; - public $manualMode = null; - public $deactivateCustomModule = null; + public $keepImages; + public $updateDefaultTheme; + public $changeToDefaultTheme; + public $keepMails; + public $manualMode; + public $deactivateCustomModule; public static $classes14 = array('Cache', 'CacheFS', 'CarrierModule', 'Db', 'FrontController', 'Helper', 'ImportModule', 'MCached', 'Module', 'ModuleGraph', 'ModuleGraphEngine', 'ModuleGrid', 'ModuleGridEngine', diff --git a/classes/Log/LegacyLogger.php b/classes/Log/LegacyLogger.php index 7ff2772d5..479180220 100644 --- a/classes/Log/LegacyLogger.php +++ b/classes/Log/LegacyLogger.php @@ -40,7 +40,7 @@ class LegacyLogger extends Logger /** * @var resource|null|false File descriptor of the log file */ - protected $fd = null; + protected $fd; public function __construct($fileName = null) { diff --git a/classes/PrestashopConfiguration.php b/classes/PrestashopConfiguration.php index f9d08c7be..527fa67db 100644 --- a/classes/PrestashopConfiguration.php +++ b/classes/PrestashopConfiguration.php @@ -33,7 +33,7 @@ class PrestashopConfiguration { // Variables used for cache - private $moduleVersion = null; + private $moduleVersion; private $allowed_array = array(); // Variables from main class diff --git a/classes/State.php b/classes/State.php index fcec2e2df..fff450f4e 100644 --- a/classes/State.php +++ b/classes/State.php @@ -33,17 +33,17 @@ class State { private $install_version; // Destination version of PrestaShop - private $backupName = null; - private $backupFilesFilename = null; - private $backupDbFilename = null; - private $restoreName = null; - private $restoreFilesFilename = null; + private $backupName; + private $backupFilesFilename; + private $backupDbFilename; + private $restoreName; + private $restoreFilesFilename; private $restoreDbFilenames = array(); // STEP BackupDb - private $backup_lines = null; - private $backup_loop_limit = null; - private $backup_table = null; + private $backup_lines; + private $backup_loop_limit; + private $backup_table; /** * Int during BackupDb, allowing the script to increent the number of different file names @@ -58,15 +58,15 @@ class State * * @var array|null File containing sample files to be deleted */ - private $removeList = null; + private $removeList; /** * @var string|null File containing files to be upgraded */ - private $fileToUpgrade = null; + private $fileToUpgrade; /** * @var string|null File containing modules to be upgraded */ - private $modulesToUpgrade = null; + private $modulesToUpgrade; /** * installedLanguagesIso is an array of iso_code of each installed languages. diff --git a/classes/UpgradeTools/ModuleAdapter.php b/classes/UpgradeTools/ModuleAdapter.php index 00dd9c9ee..36b606ad9 100644 --- a/classes/UpgradeTools/ModuleAdapter.php +++ b/classes/UpgradeTools/ModuleAdapter.php @@ -45,7 +45,7 @@ class ModuleAdapter private $zipAction; // Cached instance - private $moduleDataUpdater = null; + private $moduleDataUpdater; public function __construct($db, $translator, $modulesPath, $tempPath, $upgradeVersion, ZipAction $zipAction) { diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 42f21d5fe..cbb12a175 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -50,7 +50,7 @@ class Upgrader public $version_name; public $version_num; - public $version_is_modified = null; + public $version_is_modified; /** * @var string contains hte url where to download the file */ From 55e973a4a38c9c0cec9246235b63f6d91bc9ad77 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:28:15 +0100 Subject: [PATCH 22/35] PHP unit strict --- tests/ErrorHandlerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ErrorHandlerTest.php b/tests/ErrorHandlerTest.php index 186c30737..0722e2059 100644 --- a/tests/ErrorHandlerTest.php +++ b/tests/ErrorHandlerTest.php @@ -64,7 +64,7 @@ public function testWarningInErrorHandler() $msgs = $this->logger->getInfos(); $this->assertCount(0, $this->logger->getErrors()); $this->assertCount(1, $msgs); - $this->assertEquals(end($msgs), '[INTERNAL] ' . __FILE__ . ' line ' . $line . ' - Trololo'); + $this->assertSame(end($msgs), '[INTERNAL] ' . __FILE__ . ' line ' . $line . ' - Trololo'); } /** From 9a63aa3739c24c0475d63380662c2d96a8302000 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:23:48 +0100 Subject: [PATCH 23/35] Array indentation --- AdminSelfUpgrade.php | 8 ++++---- classes/PrestashopConfiguration.php | 2 +- classes/TaskRunner/Upgrade/BackupDb.php | 8 ++++---- classes/Upgrader.php | 10 +++++----- tests/UpgradeContainerTest.php | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index 8ecd30c1a..61c5caefc 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -79,10 +79,10 @@ class AdminSelfUpgrade extends AdminController public $deactivateCustomModule = null; public static $classes14 = array('Cache', 'CacheFS', 'CarrierModule', 'Db', 'FrontController', 'Helper', 'ImportModule', - 'MCached', 'Module', 'ModuleGraph', 'ModuleGraphEngine', 'ModuleGrid', 'ModuleGridEngine', - 'MySQL', 'Order', 'OrderDetail', 'OrderDiscount', 'OrderHistory', 'OrderMessage', 'OrderReturn', - 'OrderReturnState', 'OrderSlip', 'OrderState', 'PDF', 'RangePrice', 'RangeWeight', 'StockMvt', - 'StockMvtReason', 'SubDomain', 'Shop', 'Tax', 'TaxRule', 'TaxRulesGroup', 'WebserviceKey', 'WebserviceRequest', '', ); + 'MCached', 'Module', 'ModuleGraph', 'ModuleGraphEngine', 'ModuleGrid', 'ModuleGridEngine', + 'MySQL', 'Order', 'OrderDetail', 'OrderDiscount', 'OrderHistory', 'OrderMessage', 'OrderReturn', + 'OrderReturnState', 'OrderSlip', 'OrderState', 'PDF', 'RangePrice', 'RangeWeight', 'StockMvt', + 'StockMvtReason', 'SubDomain', 'Shop', 'Tax', 'TaxRule', 'TaxRulesGroup', 'WebserviceKey', 'WebserviceRequest', '', ); public static $maxBackupFileSize = 15728640; // 15 Mo diff --git a/classes/PrestashopConfiguration.php b/classes/PrestashopConfiguration.php index f9d08c7be..64de24fe0 100644 --- a/classes/PrestashopConfiguration.php +++ b/classes/PrestashopConfiguration.php @@ -68,7 +68,7 @@ public function getCompliancyResults() 'shop_deactivated' => (!Configuration::get('PS_SHOP_ENABLE') || (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], array('127.0.0.1', 'localhost')))), 'cache_deactivated' => !(defined('_PS_CACHE_ENABLED_') && _PS_CACHE_ENABLED_), 'module_version_ok' => $this->checkAutoupgradeLastVersion($this->getUpgrader()->autoupgrade_last_version), - )); + )); } return $this->allowed_array; diff --git a/classes/TaskRunner/Upgrade/BackupDb.php b/classes/TaskRunner/Upgrade/BackupDb.php index fbb856667..5ee251d50 100644 --- a/classes/TaskRunner/Upgrade/BackupDb.php +++ b/classes/TaskRunner/Upgrade/BackupDb.php @@ -66,10 +66,10 @@ public function run() $ignore_stats_table = array(); if (!$psBackupAll) { $ignore_stats_table = array(_DB_PREFIX_ . 'connections', - _DB_PREFIX_ . 'connections_page', - _DB_PREFIX_ . 'connections_source', - _DB_PREFIX_ . 'guest', - _DB_PREFIX_ . 'statssearch', ); + _DB_PREFIX_ . 'connections_page', + _DB_PREFIX_ . 'connections_source', + _DB_PREFIX_ . 'guest', + _DB_PREFIX_ . 'statssearch', ); } // INIT LOOP diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 42f21d5fe..6d358bc1d 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -272,11 +272,11 @@ public function getApiAddons($xml_localfile, $postData, $refresh = false) // Make the request $opts = array( 'http' => array( - 'method' => 'POST', - 'content' => $postData, - 'header' => 'Content-type: application/x-www-form-urlencoded', - 'timeout' => 10, - ), ); + 'method' => 'POST', + 'content' => $postData, + 'header' => 'Content-type: application/x-www-form-urlencoded', + 'timeout' => 10, + ), ); $context = stream_context_create($opts); $xml = false; foreach ($protocolsList as $protocol => $port) { diff --git a/tests/UpgradeContainerTest.php b/tests/UpgradeContainerTest.php index c2096b061..006010753 100644 --- a/tests/UpgradeContainerTest.php +++ b/tests/UpgradeContainerTest.php @@ -55,7 +55,7 @@ public function objectsToInstanciateProvider() array('getCookie', PrestaShop\Module\AutoUpgrade\Cookie::class), array('getFileConfigurationStorage', PrestaShop\Module\AutoUpgrade\Parameters\FileConfigurationStorage::class), array('getFileFilter', \PrestaShop\Module\AutoUpgrade\UpgradeTools\FileFilter::class), -// array('getUpgrader', \PrestaShop\Module\AutoUpgrade\Upgrader::class), + // array('getUpgrader', \PrestaShop\Module\AutoUpgrade\Upgrader::class), array('getFilesystemAdapter', PrestaShop\Module\AutoUpgrade\UpgradeTools\FilesystemAdapter::class), array('getLogger', PrestaShop\Module\AutoUpgrade\Log\LegacyLogger::class), array('getModuleAdapter', PrestaShop\Module\AutoUpgrade\UpgradeTools\ModuleAdapter::class), From 490101caea5e599295cb4fbb4d969ea6d9b59c09 Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Fri, 1 Feb 2019 16:57:41 +0000 Subject: [PATCH 24/35] Do not rollback when upgrade was not expected --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79302d3ba..e1ae023fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,8 +37,10 @@ script: # Back office -> HTTP code 200 expected - bash -c '[ "$(curl -L -s -o /dev/null -w %{http_code} http://localhost:8001/admin-dev/index.php)" == "200" ]' - # Rollback - - docker exec -u www-data -ti prestashop_autoupgrade php modules/autoupgrade/tests/testCliProcess.php admin-dev/autoupgrade/cli-rollback.php --dir="admin-dev" --backup=`docker exec -ti prestashop_autoupgrade bash -c "ls -td -- /var/www/html/admin-dev/autoupgrade/backup/*/ | head -n 1 | cut -d'/' -f8 | tr -d '\n'"` + # Rollback (only when expect a completed upgrade) + - if [ $VERSION != "latest" ]; then + docker exec -u www-data -ti prestashop_autoupgrade php modules/autoupgrade/tests/testCliProcess.php admin-dev/autoupgrade/cli-rollback.php --dir="admin-dev" --backup=`docker exec -ti prestashop_autoupgrade bash -c "ls -td -- /var/www/html/admin-dev/autoupgrade/backup/*/ | head -n 1 | cut -d'/' -f8 | tr -d '\n'"`; + fi # Front office -> HTTP code 200 expected (no maintenance) - bash -c '[ "$(curl -L -s -o /dev/null -w %{http_code} http://localhost:8001/index.php)" == "200" ]' # Back office -> HTTP code 200 expected From ccb4f18fd0e62f5467977a79d83df9708f65ae59 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:22:12 +0100 Subject: [PATCH 25/35] Comment to PHP doc --- classes/TaskRunner/Rollback/RestoreDb.php | 2 +- classes/TaskRunner/Upgrade/BackupFiles.php | 2 +- classes/Upgrader.php | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/classes/TaskRunner/Rollback/RestoreDb.php b/classes/TaskRunner/Rollback/RestoreDb.php index c23c039bf..ee08898d5 100644 --- a/classes/TaskRunner/Rollback/RestoreDb.php +++ b/classes/TaskRunner/Rollback/RestoreDb.php @@ -147,7 +147,7 @@ public function run() } } - // @todo : error if listQuery is not an array (that can happen if toRestoreQueryList is empty for example) + /** @todo : error if listQuery is not an array (that can happen if toRestoreQueryList is empty for example) */ $time_elapsed = time() - $startTime; if (is_array($listQuery) && count($listQuery) > 0) { $this->container->getDb()->execute('SET SESSION sql_mode = \'\''); diff --git a/classes/TaskRunner/Upgrade/BackupFiles.php b/classes/TaskRunner/Upgrade/BackupFiles.php index fbb268d5c..1c753130b 100644 --- a/classes/TaskRunner/Upgrade/BackupFiles.php +++ b/classes/TaskRunner/Upgrade/BackupFiles.php @@ -55,7 +55,7 @@ public function run() } if (!$this->container->getFileConfigurationStorage()->exists(UpgradeFileNames::FILES_TO_BACKUP_LIST)) { - // @todo : only add files and dir listed in "originalPrestashopVersion" list + /** @todo : only add files and dir listed in "originalPrestashopVersion" list */ $filesToBackup = $this->container->getFilesystemAdapter()->listFilesInDir($this->container->getProperty(UpgradeContainer::PS_ROOT_PATH), 'backup', false); $this->container->getFileConfigurationStorage()->save($filesToBackup, UpgradeFileNames::FILES_TO_BACKUP_LIST); if (count($filesToBackup)) { diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 7ff5a14a2..981208585 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -405,8 +405,10 @@ public function md5FileAsArray($node, $dir = '/') foreach ($node as $key => $child) { if (is_object($child) && $child->getName() == 'dir') { $dir = (string) $child['name']; - // $current_path = $dir.(string)$child['name']; - // @todo : something else than array pop ? + /** + * $current_path = $dir.(string)$child['name']; + * @todo : something else than array pop ? + */ $dir_content = $this->md5FileAsArray($child, $dir); $array[$dir] = $dir_content; } elseif (is_object($child) && $child->getName() == 'md5file') { From af89f810996093a2a949e22303f8185f641c9454 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:22:22 +0100 Subject: [PATCH 26/35] Doctrine annotation without dot --- functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions.php b/functions.php index b5f6a50fe..23893cc2a 100755 --- a/functions.php +++ b/functions.php @@ -281,7 +281,7 @@ function checkTabRights($id_tab) * @param string $childrenKey index for children, in case $flattenChildren was set to * false. Defaults to "@children" * - * @return array the resulting array. + * @return array the resulting array */ function simpleXMLToArray($xml, $flattenValues = true, $flattenAttributes = true, $flattenChildren = true, $valueKey = '@value', $attributesKey = '@attributes', $childrenKey = '@children') { From 9f21d0ea3581ccef64dac2efbe6a66455a7385d3 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:22:41 +0100 Subject: [PATCH 27/35] Doctrine summary --- classes/Tools14.php | 4 ++-- classes/UpgradeTools/Translator.php | 2 +- classes/Upgrader.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/Tools14.php b/classes/Tools14.php index cafdbbe12..03fe014c2 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -1389,7 +1389,7 @@ public static function file_exists_cache($filename) } /** - * Check config & source file to settle which dl method to use + * Check config & source file to settle which dl method to use. */ public static function shouldUseFopen($url) { @@ -2444,7 +2444,7 @@ public static function nl2br($str) } /** - * Copy a file to another place + * Copy a file to another place. * * @return bool True if the copy succeded */ diff --git a/classes/UpgradeTools/Translator.php b/classes/UpgradeTools/Translator.php index 288453023..a90970fe1 100644 --- a/classes/UpgradeTools/Translator.php +++ b/classes/UpgradeTools/Translator.php @@ -37,7 +37,7 @@ public function __construct($caller) } /** - * Translate a string to the current language + * 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. diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 981208585..1cdcd3efb 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -406,7 +406,7 @@ public function md5FileAsArray($node, $dir = '/') if (is_object($child) && $child->getName() == 'dir') { $dir = (string) $child['name']; /** - * $current_path = $dir.(string)$child['name']; + * $current_path = $dir.(string)$child['name'];. * @todo : something else than array pop ? */ $dir_content = $this->md5FileAsArray($child, $dir); From 5826503c60797ca698ae6d857d4c6dc3b5388951 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:22:45 +0100 Subject: [PATCH 28/35] Align multiline comment --- functions.php | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/functions.php b/functions.php index 23893cc2a..dd5985853 100755 --- a/functions.php +++ b/functions.php @@ -1,28 +1,28 @@ -* @copyright 2007-2016 PrestaShop SA -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ + * 2007-2016 PrestaShop. + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to http://www.prestashop.com for more information. + * + * @author PrestaShop SA + * @copyright 2007-2016 PrestaShop SA + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ /** * Generate a new settings file, only transmitted parameters are updated. From 723bc39ab1ae61181ae91c7f50cfe080ee0f1850 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:22:47 +0100 Subject: [PATCH 29/35] Doctrine separation --- classes/Upgrader.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 1cdcd3efb..e67964ef5 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -407,6 +407,7 @@ public function md5FileAsArray($node, $dir = '/') $dir = (string) $child['name']; /** * $current_path = $dir.(string)$child['name'];. + * * @todo : something else than array pop ? */ $dir_content = $this->md5FileAsArray($child, $dir); From b9a98d5c5ec676da2f134622a41a9b6583cfefc4 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:22:57 +0100 Subject: [PATCH 30/35] No blank lines after phpdoc --- classes/BackupFinder.php | 1 - classes/ChannelInfo.php | 1 - classes/Parameters/UpgradeConfiguration.php | 1 - classes/Tools14.php | 1 - classes/Twig/Block/ChannelInfoBlock.php | 1 - classes/Twig/Block/RollbackForm.php | 1 - classes/Twig/Block/UpgradeButtonBlock.php | 1 - classes/Twig/Block/UpgradeChecklist.php | 1 - classes/Twig/Form/BackupOptionsForm.php | 1 - classes/Twig/Form/FormRenderer.php | 1 - classes/Twig/Form/UpgradeOptionsForm.php | 1 - classes/UpgradePage.php | 1 - classes/UpgradeSelfCheck.php | 1 - classes/Upgrader.php | 1 - 14 files changed, 14 deletions(-) diff --git a/classes/BackupFinder.php b/classes/BackupFinder.php index 42b1292cf..cad8dde6b 100644 --- a/classes/BackupFinder.php +++ b/classes/BackupFinder.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade; class BackupFinder diff --git a/classes/ChannelInfo.php b/classes/ChannelInfo.php index cd615cc13..1b1fb1fe3 100644 --- a/classes/ChannelInfo.php +++ b/classes/ChannelInfo.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade; use PrestaShop\Module\AutoUpgrade\Parameters\UpgradeConfiguration; diff --git a/classes/Parameters/UpgradeConfiguration.php b/classes/Parameters/UpgradeConfiguration.php index c2ddd7313..f2d40b71a 100644 --- a/classes/Parameters/UpgradeConfiguration.php +++ b/classes/Parameters/UpgradeConfiguration.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Parameters; use Doctrine\Common\Collections\ArrayCollection; diff --git a/classes/Tools14.php b/classes/Tools14.php index 03fe014c2..b20942f52 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade; use Tab; diff --git a/classes/Twig/Block/ChannelInfoBlock.php b/classes/Twig/Block/ChannelInfoBlock.php index cbdc6fce8..0491ae598 100644 --- a/classes/Twig/Block/ChannelInfoBlock.php +++ b/classes/Twig/Block/ChannelInfoBlock.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Twig\Block; use PrestaShop\Module\AutoUpgrade\ChannelInfo; diff --git a/classes/Twig/Block/RollbackForm.php b/classes/Twig/Block/RollbackForm.php index aeee76d0e..29c0226a6 100644 --- a/classes/Twig/Block/RollbackForm.php +++ b/classes/Twig/Block/RollbackForm.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Twig\Block; use PrestaShop\Module\AutoUpgrade\BackupFinder; diff --git a/classes/Twig/Block/UpgradeButtonBlock.php b/classes/Twig/Block/UpgradeButtonBlock.php index 8f4e7d593..84c9c2dbc 100644 --- a/classes/Twig/Block/UpgradeButtonBlock.php +++ b/classes/Twig/Block/UpgradeButtonBlock.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Twig\Block; use Configuration; diff --git a/classes/Twig/Block/UpgradeChecklist.php b/classes/Twig/Block/UpgradeChecklist.php index 76813d6c5..2735be5da 100644 --- a/classes/Twig/Block/UpgradeChecklist.php +++ b/classes/Twig/Block/UpgradeChecklist.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Twig\Block; use PrestaShop\Module\AutoUpgrade\UpgradeSelfCheck; diff --git a/classes/Twig/Form/BackupOptionsForm.php b/classes/Twig/Form/BackupOptionsForm.php index 0e74382e9..f7b5c66e5 100644 --- a/classes/Twig/Form/BackupOptionsForm.php +++ b/classes/Twig/Form/BackupOptionsForm.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Twig\Form; use PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator; diff --git a/classes/Twig/Form/FormRenderer.php b/classes/Twig/Form/FormRenderer.php index 9bf87b6de..fdfcbbecd 100644 --- a/classes/Twig/Form/FormRenderer.php +++ b/classes/Twig/Form/FormRenderer.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Twig\Form; use PrestaShop\Module\AutoUpgrade\Parameters\UpgradeConfiguration; diff --git a/classes/Twig/Form/UpgradeOptionsForm.php b/classes/Twig/Form/UpgradeOptionsForm.php index 2f4a8cd9a..652f2036e 100644 --- a/classes/Twig/Form/UpgradeOptionsForm.php +++ b/classes/Twig/Form/UpgradeOptionsForm.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade\Twig\Form; use PrestaShop\Module\AutoUpgrade\UpgradeTools\Translator; diff --git a/classes/UpgradePage.php b/classes/UpgradePage.php index d211b9cb1..0b0fb858f 100644 --- a/classes/UpgradePage.php +++ b/classes/UpgradePage.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade; use PrestaShop\Module\AutoUpgrade\Twig\Block\RollbackForm; diff --git a/classes/UpgradeSelfCheck.php b/classes/UpgradeSelfCheck.php index fc035fe60..f531a51dd 100644 --- a/classes/UpgradeSelfCheck.php +++ b/classes/UpgradeSelfCheck.php @@ -24,7 +24,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade; use Configuration; diff --git a/classes/Upgrader.php b/classes/Upgrader.php index e67964ef5..3473052c2 100755 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - namespace PrestaShop\Module\AutoUpgrade; use Symfony\Component\Filesystem\Filesystem; From 022dd09eb92f0d2105f1c373e9089d7261fc339c Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:23:03 +0100 Subject: [PATCH 31/35] Multiline comment opening closing --- classes/Tools14.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Tools14.php b/classes/Tools14.php index b20942f52..5757baeee 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -1291,7 +1291,7 @@ public static function isEmpty($field) /** * @deprecated - **/ + */ public static function getTimezones($select = false) { static $_cache = 0; @@ -1319,7 +1319,7 @@ public static function getTimezones($select = false) /** * @deprecated - **/ + */ public static function ps_set_magic_quotes_runtime($var) { if (function_exists('set_magic_quotes_runtime')) { From 831f95a4b24fd5359f564925d8a347477cb0555d Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:23:05 +0100 Subject: [PATCH 32/35] No trailing whitespace in comment --- classes/Tools14.php | 2 +- classes/UpgradeTools/Translator.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/Tools14.php b/classes/Tools14.php index 5757baeee..c1afc0181 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -2444,7 +2444,7 @@ public static function nl2br($str) /** * Copy a file to another place. - * + * * @return bool True if the copy succeded */ public static function copy($source, $destination, $stream_context = null) diff --git a/classes/UpgradeTools/Translator.php b/classes/UpgradeTools/Translator.php index a90970fe1..e17b0ff32 100644 --- a/classes/UpgradeTools/Translator.php +++ b/classes/UpgradeTools/Translator.php @@ -38,10 +38,10 @@ public function __construct($caller) /** * 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 From a4198f747bd47e5c71e9376a1fa96dab5c507b1b Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Mon, 24 Dec 2018 16:23:08 +0100 Subject: [PATCH 33/35] Single line comment style --- AdminSelfUpgrade.php | 4 ++-- autoupgrade.php | 22 +++++++++---------- classes/AjaxResponse.php | 8 ++----- classes/State.php | 8 ++----- classes/TaskRunner/AbstractTask.php | 2 +- classes/TaskRunner/Upgrade/CleanDatabase.php | 2 +- classes/TaskRunner/Upgrade/UpgradeFiles.php | 4 +--- classes/Tools14.php | 11 +++++----- classes/Twig/Form/FormRenderer.php | 2 +- classes/UpgradePage.php | 2 +- .../CoreUpgrader/CoreUpgrader.php | 10 ++++----- classes/pclzip.lib.php | 2 +- 12 files changed, 34 insertions(+), 43 deletions(-) diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index d2f9ba413..30fdee806 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -213,7 +213,7 @@ public function init() ); // If you have defined this somewhere, you know what you do - /* load options from configuration if we're not in ajax mode */ + // load options from configuration if we're not in ajax mode if (!$this->ajax) { $upgrader = $this->upgradeContainer->getUpgrader(); $this->upgradeContainer->getCookie()->create( @@ -356,7 +356,7 @@ public function postProcess() public function display() { - /* Make sure the user has configured the upgrade options, or set default values */ + // Make sure the user has configured the upgrade options, or set default values $configuration_keys = array( 'PS_AUTOUP_UPDATE_DEFAULT_THEME' => 1, 'PS_AUTOUP_CHANGE_DEFAULT_THEME' => 0, diff --git a/autoupgrade.php b/autoupgrade.php index c0d3f09ea..367b047c9 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -65,7 +65,7 @@ public function install() return false; } - /* Before creating a new tab "AdminSelfUpgrade" we need to remove any existing "AdminUpgrade" tab (present in v1.4.4.0 and v1.4.4.1) */ + // Before creating a new tab "AdminSelfUpgrade" we need to remove any existing "AdminUpgrade" tab (present in v1.4.4.0 and v1.4.4.1) if ($id_tab = Tab::getIdFromClassName('AdminUpgrade')) { $tab = new Tab((int) $id_tab); if (!$tab->delete()) { @@ -73,7 +73,7 @@ public function install() } } - /* If the "AdminSelfUpgrade" tab does not exist yet, create it */ + // If the "AdminSelfUpgrade" tab does not exist yet, create it if (!$id_tab = Tab::getIdFromClassName('AdminSelfUpgrade')) { $tab = new Tab(); $tab->class_name = 'AdminSelfUpgrade'; @@ -92,35 +92,35 @@ public function install() $tab = new Tab((int) $id_tab); } - /* Update the "AdminSelfUpgrade" tab id in database or exit */ + // Update the "AdminSelfUpgrade" tab id in database or exit if (Validate::isLoadedObject($tab)) { Configuration::updateValue('PS_AUTOUPDATE_MODULE_IDTAB', (int) $tab->id); } else { return $this->_abortInstall($this->trans('Unable to load the "AdminSelfUpgrade" tab', array(), 'Modules.Autoupgrade.Admin')); } - /* Check that the 1-click upgrade working directory is existing or create it */ + // Check that the 1-click upgrade working directory is existing or create it $autoupgrade_dir = _PS_ADMIN_DIR_ . DIRECTORY_SEPARATOR . 'autoupgrade'; if (!file_exists($autoupgrade_dir) && !@mkdir($autoupgrade_dir)) { return $this->_abortInstall($this->trans('Unable to create the directory "%s"', array($autoupgrade_dir), 'Modules.Autoupgrade.Admin')); } - /* Make sure that the 1-click upgrade working directory is writeable */ + // Make sure that the 1-click upgrade working directory is writeable if (!is_writable($autoupgrade_dir)) { return $this->_abortInstall($this->trans('Unable to write in the directory "%s"', array($autoupgrade_dir), 'Modules.Autoupgrade.Admin')); } - /* If a previous version of ajax-upgradetab.php exists, delete it */ + // If a previous version of ajax-upgradetab.php exists, delete it if (file_exists($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) { @unlink($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php'); } - /* Then, try to copy the newest version from the module's directory */ + // Then, try to copy the newest version from the module's directory if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php', $autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) { return $this->_abortInstall($this->trans('Unable to copy ajax-upgradetab.php in %s', array($autoupgrade_dir), 'Modules.Autoupgrade.Admin')); } - /* Make sure that the XML config directory exists */ + // Make sure that the XML config directory exists if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml') && !@mkdir(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml', 0775)) { return $this->_abortInstall($this->trans('Unable to create the directory "%s"', array(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'), 'Modules.Autoupgrade.Admin')); @@ -128,7 +128,7 @@ public function install() @chmod(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml', 0775); } - /* Create a dummy index.php file in the XML config directory to avoid directory listing */ + // Create a dummy index.php file in the XML config directory to avoid directory listing if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php') && (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'))) { @@ -140,13 +140,13 @@ public function install() public function uninstall() { - /* Delete the 1-click upgrade Back-office tab */ + // Delete the 1-click upgrade Back-office tab if ($id_tab = Tab::getIdFromClassName('AdminSelfUpgrade')) { $tab = new Tab((int) $id_tab); $tab->delete(); } - /* Remove the 1-click upgrade working directory */ + // Remove the 1-click upgrade working directory self::_removeDirectory(_PS_ADMIN_DIR_ . DIRECTORY_SEPARATOR . 'autoupgrade'); return parent::uninstall(); diff --git a/classes/AjaxResponse.php b/classes/AjaxResponse.php index a3aa79a21..71bf23023 100644 --- a/classes/AjaxResponse.php +++ b/classes/AjaxResponse.php @@ -123,9 +123,7 @@ public function getJson() return json_encode($this->getResponse()); } - /* - * GETTERS - */ + // GETTERS public function getError() { @@ -157,9 +155,7 @@ public function getUpgradeConfiguration() return $this->upgradeConfiguration; } - /* - * SETTERS - */ + // SETTERS public function setError($error) { diff --git a/classes/State.php b/classes/State.php index fff450f4e..f1551c6f7 100644 --- a/classes/State.php +++ b/classes/State.php @@ -155,9 +155,7 @@ function ($v) { return $v['iso_code']; }, $this->setBackupName($backupName); } - /* - * GETTERS - */ + // GETTERS public function getInstallVersion() { return $this->install_version; @@ -233,9 +231,7 @@ public function getWarningExists() return $this->warning_exists; } - /* - * SETTERS - */ + // SETTERS public function setInstallVersion($install_version) { $this->install_version = $install_version; diff --git a/classes/TaskRunner/AbstractTask.php b/classes/TaskRunner/AbstractTask.php index c01de1879..11c4b2227 100644 --- a/classes/TaskRunner/AbstractTask.php +++ b/classes/TaskRunner/AbstractTask.php @@ -103,7 +103,7 @@ public function getResponse() private function checkTaskMayRun() { - /* PrestaShop demo mode */ + // PrestaShop demo mode if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_) { return; } diff --git a/classes/TaskRunner/Upgrade/CleanDatabase.php b/classes/TaskRunner/Upgrade/CleanDatabase.php index c4c326775..aae284f16 100644 --- a/classes/TaskRunner/Upgrade/CleanDatabase.php +++ b/classes/TaskRunner/Upgrade/CleanDatabase.php @@ -36,7 +36,7 @@ class CleanDatabase extends AbstractTask { public function run() { - /* Clean tabs order */ + // Clean tabs order foreach ($this->container->getDb()->ExecuteS('SELECT DISTINCT id_parent FROM ' . _DB_PREFIX_ . 'tab') as $parent) { $i = 1; foreach ($this->container->getDb()->ExecuteS('SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab WHERE id_parent = ' . (int) $parent['id_parent'] . ' ORDER BY IF(class_name IN ("AdminHome", "AdminDashboard"), 1, 2), position ASC') as $child) { diff --git a/classes/TaskRunner/Upgrade/UpgradeFiles.php b/classes/TaskRunner/Upgrade/UpgradeFiles.php index 9109ca634..dc0e74059 100644 --- a/classes/TaskRunner/Upgrade/UpgradeFiles.php +++ b/classes/TaskRunner/Upgrade/UpgradeFiles.php @@ -38,9 +38,7 @@ class UpgradeFiles extends AbstractTask public function run() { - /* - * The first call must init the list of files be upgraded - */ + // The first call must init the list of files be upgraded if (!$this->container->getFileConfigurationStorage()->exists(UpgradeFileNames::FILES_TO_UPGRADE_LIST)) { return $this->warmUp(); } diff --git a/classes/Tools14.php b/classes/Tools14.php index c1afc0181..cafdbbe12 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ + namespace PrestaShop\Module\AutoUpgrade; use Tab; @@ -1291,7 +1292,7 @@ public static function isEmpty($field) /** * @deprecated - */ + **/ public static function getTimezones($select = false) { static $_cache = 0; @@ -1319,7 +1320,7 @@ public static function getTimezones($select = false) /** * @deprecated - */ + **/ public static function ps_set_magic_quotes_runtime($var) { if (function_exists('set_magic_quotes_runtime')) { @@ -1388,7 +1389,7 @@ public static function file_exists_cache($filename) } /** - * Check config & source file to settle which dl method to use. + * Check config & source file to settle which dl method to use */ public static function shouldUseFopen($url) { @@ -2443,8 +2444,8 @@ public static function nl2br($str) } /** - * Copy a file to another place. - * + * Copy a file to another place + * * @return bool True if the copy succeded */ public static function copy($source, $destination, $stream_context = null) diff --git a/classes/Twig/Form/FormRenderer.php b/classes/Twig/Form/FormRenderer.php index fdfcbbecd..d1b0656a2 100644 --- a/classes/Twig/Form/FormRenderer.php +++ b/classes/Twig/Form/FormRenderer.php @@ -70,7 +70,7 @@ public function render($name, $fields, $tabname, $size, $icon) . '
'; } - /* Display the appropriate input type for each field */ + // Display the appropriate input type for each field switch ($field['type']) { case 'disabled': $html .= $field['disabled']; diff --git a/classes/UpgradePage.php b/classes/UpgradePage.php index 0b0fb858f..1f1e129b7 100644 --- a/classes/UpgradePage.php +++ b/classes/UpgradePage.php @@ -267,7 +267,7 @@ private function getErrorMessage() { $translator = $this->translator; - /* PrestaShop demo mode */ + // PrestaShop demo mode if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_) { return array( 'message' => $translator->trans('This functionality has been disabled.', array(), self::TRANSLATION_DOMAIN), diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php index f5dc56863..17b10414c 100644 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php +++ b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php @@ -119,7 +119,7 @@ protected function initConstants() @ini_set('memory_limit', '512M'); } - /* Redefine REQUEST_URI if empty (on some webservers...) */ + // Redefine REQUEST_URI if empty (on some webservers...) if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI'])) { if (!isset($_SERVER['SCRIPT_NAME']) && isset($_SERVER['SCRIPT_FILENAME'])) { $_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_FILENAME']; @@ -335,7 +335,7 @@ protected function runQuery($upgrade_file, $query) if (empty($query)) { return; } - /* If php code have to be executed */ + // If php code have to be executed if (strpos($query, '/* PHP:') !== false) { return $this->runPhpQuery($upgrade_file, $query); } @@ -344,7 +344,7 @@ protected function runQuery($upgrade_file, $query) protected function runPhpQuery($upgrade_file, $query) { - /* Parsing php code */ + // Parsing php code $pos = strpos($query, '/* PHP:') + strlen('/* PHP:'); $phpString = substr($query, $pos, strlen($query) - $pos - strlen(' */;')); $php = explode('::', $phpString); @@ -360,7 +360,7 @@ protected function runPhpQuery($upgrade_file, $query) // reset phpRes to a null value $phpRes = null; - /* Call a simple function */ + // Call a simple function if (strpos($phpString, '::') === false) { $func_name = str_replace($pattern[0], '', $php[0]); @@ -372,7 +372,7 @@ protected function runPhpQuery($upgrade_file, $query) $phpRes = call_user_func_array($func_name, $parameters); } } - /* Or an object method */ + // Or an object method else { $func_name = array($php[0], str_replace($pattern[0], '', $php[1])); $this->logger->error('[ERROR] ' . $upgrade_file . ' PHP - Object Method call is forbidden (' . $php[0] . '::' . str_replace($pattern[0], '', $php[1]) . ')'); diff --git a/classes/pclzip.lib.php b/classes/pclzip.lib.php index 582a817c9..8a05f979f 100755 --- a/classes/pclzip.lib.php +++ b/classes/pclzip.lib.php @@ -4595,7 +4595,7 @@ public function privDeleteByRule(&$p_result_list, &$p_options) if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_found = true; - } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ + } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) // Indicates a folder && ($v_header_list[$v_nb_extracted]['stored_filename'] . '/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_found = true; } From 8929e13f719fc4f802942d2ebd7fdfbf9303377c Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Tue, 5 Feb 2019 16:13:27 +0000 Subject: [PATCH 34/35] Update module logo --- logo.png | Bin 2853 -> 1521 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/logo.png b/logo.png index ab3853771a7cdd0f3e8a21169a3135fac1439b1b..d7df3dd789124e086de7b80609e4367d09e4c433 100644 GIT binary patch delta 1514 zcmVp(R7C&)0NM2U*7Eq@_4(rV`sVoi<@o#m z|NsC0|I_jJGa#8Ix!2P0_R;V4%joXI-{iN_*RIFRH6xj#v)Rq+@X+q{#Ng+;)!MMh z&O|t%&g}Bf?ejpw+|20n$K&ceEuYTo@j)`7&+PSTXt_o>q<=UjoHitzURklo;_%An z?W?`urncQWDV(k4@WI>cqOsb5g~!R~?8)WpyVB~v+~J$3*O8jheSpMye86;ezi@E9 zXJfZlPOd~apT^+sw#(+T$>g@r)tRQ$mZH?M%+ZaO&V!1>VqCOOM5pcRISbL_OZp|yw&1e z%i^!Z+o-$Op|I1RuhXl;$VEr1Nj|2*XSv_*r~zBkevmDK@bo{ao_h{|Nl4Z)kAD%N|JMv%+ZtYfd}rK(~p^(--Ll- z$oSZ3Y=no%NNjX$oE>m9#x)Q-%6@a~2-n1sV<@2M^U(n3pKGMQ3ga=Zk=QsJ<60SG zqg*SaEPuwe5@RD=Dh-T+)?QL%spxK@MT)bE{7n;s450#g^k;z1@p;bj@<0%Gy%LO`t7!On^6MP(xdARr1AQ1S4l+z3Gkh<~|FP_y-X+OZMn0-{}lV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Mm%-=974+Ir#-QiK9^GU+vkneb&Z*dxb~4G%Qio sr>u=u^tD##{3RzQC-n81R?Q(FhiV>c^@-ZMBl!!M8Ce=u7+_=n2SMp!82|tP From 6f0ea609a1e66e62bdf033f2c72fd809050c60f0 Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Tue, 19 Feb 2019 11:03:04 +0100 Subject: [PATCH 35/35] Bump module version to v4.6.0 --- autoupgrade.php | 2 +- config.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoupgrade.php b/autoupgrade.php index 367b047c9..a751e89a6 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.5.1'; + $this->version = '4.6.0'; $this->need_instance = 1; $this->bootstrap = true; diff --git a/config.xml b/config.xml index e34721430..26f7b961e 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ autoupgrade - +