diff --git a/README.md b/README.md index 7e46d9b..ef0fb65 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ For more information, go to https://www.luigifab.fr/openmage/minifier (IPv6 is r This repository is a releases mirror. To install the module, please use the composer key available in the documentation. -- Current version: 4.3.0 (03/03/2022) +- Current version: 4.3.1 (07/07/2022) - Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1 - Client compatibility: Firefox 36+, Chrome 32+, Opera 19+, Edge 16+, Safari 9+ - Translations: English (en), French (fr-FR/fr-CA), German (de), Italian (it), Portuguese (pt-PT/pt-BR), Spanish (es) / Chinese (zh), Czech (cs), Dutch (nl), Greek (el), Hungarian (hu), Japanese (ja), Polish (pl), Romanian (ro), Russian (ru), Slovak (sk), Turkish (tr), Ukrainian (uk) diff --git a/composer.json b/composer.json index a3aa748..e1cf36e 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "require": { "php": ">=7.2.0", "openmage/magento-lts": ">=19.4.0", + "symfony/polyfill-php80": "*", "ext-mbstring": "*", "ext-json": "*", "ext-curl": "*", diff --git a/src/app/code/community/Luigifab/Minifier/Model/Files.php b/src/app/code/community/Luigifab/Minifier/Model/Files.php index 71b0213..48dc79a 100644 --- a/src/app/code/community/Luigifab/Minifier/Model/Files.php +++ b/src/app/code/community/Luigifab/Minifier/Model/Files.php @@ -1,7 +1,7 @@ * Copyright 2022 | Fabrice Creuzot @@ -144,10 +144,10 @@ protected function minifyFiles(array $items) { while (count($pids) >= $core) { foreach ($pids as $key => $pid) { - if (!file_exists('/proc/'.$pid)) - unset($pids[$key]); - else + if (file_exists('/proc/'.$pid)) clearstatcache('/proc/'.$pid); + else + unset($pids[$key]); } usleep(100000); // 0.1 s } @@ -156,10 +156,10 @@ protected function minifyFiles(array $items) { while (!empty($pids)) { foreach ($pids as $key => $pid) { - if (!file_exists('/proc/'.$pid)) - unset($pids[$key]); - else + if (file_exists('/proc/'.$pid)) clearstatcache('/proc/'.$pid); + else + unset($pids[$key]); } usleep(100000); // 0.1 s } diff --git a/src/app/code/community/Luigifab/Minifier/Model/Observer.php b/src/app/code/community/Luigifab/Minifier/Model/Observer.php index 86e1866..71766fc 100644 --- a/src/app/code/community/Luigifab/Minifier/Model/Observer.php +++ b/src/app/code/community/Luigifab/Minifier/Model/Observer.php @@ -1,7 +1,7 @@ * https://www.luigifab.fr/openmage/minifier @@ -86,7 +86,7 @@ static function ($items, $item) { // ajoute la locale présente dans l'url en premier car elle est prioritaire if (!empty($_GET['lang'])) { $code = str_replace('-', '_', $_GET['lang']); - if (strpos($code, '_') !== false) + if (str_contains($code, '_')) array_unshift($codes, substr($code, 0, strpos($code, '_'))); array_unshift($codes, $code); } @@ -95,7 +95,7 @@ static function ($items, $item) { // essaye es ou fil puis es_ES ou fil_PH foreach ($codes as $code) { - if ((strlen($code) >= 2) && (strpos($code, '_') === false)) { + if ((strlen($code) >= 2) && !str_contains($code, '_')) { // es devient es_ES de manière à prioriser es_ES au lieu d'utiliser es_XX if (in_array($code.'_'.strtoupper($code), $locales)) { $result = $code.'_'.strtoupper($code); diff --git a/src/app/code/community/Luigifab/Minifier/Model/Rewrite/Package.php b/src/app/code/community/Luigifab/Minifier/Model/Rewrite/Package.php index 5b884c7..e34577a 100644 --- a/src/app/code/community/Luigifab/Minifier/Model/Rewrite/Package.php +++ b/src/app/code/community/Luigifab/Minifier/Model/Rewrite/Package.php @@ -1,7 +1,7 @@ * Copyright 2022 | Fabrice Creuzot @@ -52,7 +52,7 @@ public function getFinalUrl($fileName, $url) { return str_replace('-zzyyxx', '', $url); $key = (is_file($fileName) ? date('-YmdHis', filemtime($fileName)) : '-00000000000000'); - return str_replace([basename($url), '-zzyyxx'], [preg_replace('#\.#', $key . '.', basename($url), 1), ''], $url); + return str_replace([basename($url), '-zzyyxx'], [preg_replace('#\.#', $key.'.', basename($url), 1), ''], $url); } public function getSkinUrl($file = null, array $params = []) { @@ -65,7 +65,7 @@ public function getSkinUrl($file = null, array $params = []) { // prevent reading files outside of the proper directory while still allowing symlinked files Varien_Profiler::start(__METHOD__); - if (strpos($file, '..') !== false) { + if (str_contains($file, '..')) { Mage::log(sprintf('Invalid path requested: %s (params: %s)', $file, json_encode($params)), Zend_Log::ERR); throw new RuntimeException('Invalid path requested.'); } diff --git a/src/app/code/community/Luigifab/Minifier/controllers/DebugController.php b/src/app/code/community/Luigifab/Minifier/controllers/DebugController.php index 8fc56fd..bc2aaeb 100644 --- a/src/app/code/community/Luigifab/Minifier/controllers/DebugController.php +++ b/src/app/code/community/Luigifab/Minifier/controllers/DebugController.php @@ -1,7 +1,7 @@ * https://www.luigifab.fr/openmage/minifier @@ -134,7 +134,7 @@ public function startAction() { $passwd = Mage::getStoreConfig('minifier/cssjs/debug_password'); if (Mage::getStoreConfigFlag('minifier/cssjs/debug_enabled') && (empty($passwd) || ($this->getRequest()->getParam('pass') == $passwd))) { - Mage::getSingleton('core/cookie')->set('minifier', 1); + Mage::getSingleton('core/cookie')->set('minifier', 1, true); $this->_redirect('*/*/index', ['pass' => $passwd]); } else { diff --git a/src/app/code/community/Luigifab/Minifier/etc/config.xml b/src/app/code/community/Luigifab/Minifier/etc/config.xml index 33686b7..ac0f5e9 100644 --- a/src/app/code/community/Luigifab/Minifier/etc/config.xml +++ b/src/app/code/community/Luigifab/Minifier/etc/config.xml @@ -1,7 +1,7 @@