diff --git a/FUNDING.yml b/FUNDING.yml deleted file mode 100644 index eda3c7b..0000000 --- a/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: ["https://fr.tipeee.com/luigifab", "https://gandi.link/f/4b904048", "https://ekwateur.fr/?parrain=EKW001147103", "https://www.ebuyclub.com/?parrain=ebc4"] \ No newline at end of file diff --git a/README.md b/README.md index 1e87b86..ebddf69 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ 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.5.2 (16/06/2023) -- Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 +- Current version: 4.5.3 (10/10/2023) +- Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3 - 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) - License: GNU GPL 2+ diff --git a/composer.json b/composer.json index 1c20c02..6bb970f 100644 --- a/composer.json +++ b/composer.json @@ -16,20 +16,6 @@ "issues": "https://github.com/luigifab/openmage-minifier/issues", "docs": "https://www.luigifab.fr/openmage/minifier" }, - "funding": [ - { - "type": "other", - "url": "https://gandi.link/f/4b904048" - }, - { - "type": "other", - "url": "https://fr.tipeee.com/luigifab" - }, - { - "type": "other", - "url": "https://ekwateur.fr/?parrain=EKW001147103" - } - ], "require": { "php": ">=7.2.0", "openmage/magento-lts": ">=19.4.0 || main-dev || next-dev", diff --git a/src/app/code/community/Luigifab/Minifier/Block/Adminhtml/Config/Server.php b/src/app/code/community/Luigifab/Minifier/Block/Adminhtml/Config/Server.php index e4afafb..6907cc9 100644 --- a/src/app/code/community/Luigifab/Minifier/Block/Adminhtml/Config/Server.php +++ b/src/app/code/community/Luigifab/Minifier/Block/Adminhtml/Config/Server.php @@ -1,7 +1,7 @@ * https://github.com/luigifab/openmage-minifier @@ -22,7 +22,10 @@ class Luigifab_Minifier_Block_Adminhtml_Config_Server extends Mage_Adminhtml_Blo public function render(Varien_Data_Form_Element_Abstract $element) { // getPath PR 2774 - return str_replace(['`', "\n"], [chr(194).chr(160), '
'], '## THE REQUIRED CONFIGURATION + return str_replace( + ['`', "\n"], + [chr(194).chr(160), '
'], // not mb_chr + '## THE REQUIRED CONFIGURATION ## for apache (virtual host or htaccess) RewriteRule (.*)skin/.*/favicon.ico $1favicon.ico [L] diff --git a/src/app/code/community/Luigifab/Minifier/Model/Files.php b/src/app/code/community/Luigifab/Minifier/Model/Files.php index aea18eb..8e3219d 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-2023 | Fabrice Creuzot @@ -123,12 +123,15 @@ protected function minifyFiles(array $items) { if (is_file($source) && !is_file($cache)) { - if (empty($core)) { - $core = max(1, Mage::helper('minifier')->getNumberOfCpuCore() - 2); - $maxc = ceil($core * 1.5); + if (empty($maxc)) { + // leaves 2 cores free, but because $runs include grep check, we add 2 for $maxc + // [] => 18:14 0:00 php ... + // [] => 18:14 0:00 sh -c ps aux | grep Minifier/lib/minify.php + // [] => 18:14 0:00 grep Minifier/lib/minify.php + $maxc = 2 + max(1, Mage::helper('minifier')->getNumberOfCpuCore() - 2); } - while (count($pids) >= $core) { + while (count($pids) >= $maxc) { foreach ($pids as $key => $pid) { if (file_exists('/proc/'.$pid)) clearstatcache('/proc/'.$pid); @@ -520,14 +523,14 @@ protected function getMinifiedName(string $file, bool $md5 = true, bool $min = t // example.js => example.md5name.js if ($min) { - $key = substr(md5($file), 0, 10); + $key = substr(md5($file), 0, 10); // not mb_substr $name = str_replace(['.css', '.js'], ['.'.$key.'.css', '.'.$key.'.js'], $name); } // example.js => example.md5content.min.js // example.md5name.js => example.md5name.md5content.min.js if ($md5) { - $key = is_file($file) ? substr(md5_file($file), 0, 10) : 'na'; + $key = is_file($file) ? substr(md5_file($file), 0, 10) : 'na'; // not mb_substr $name = str_replace(['.css', '.js'], ['.'.$key.'.min.css', '.'.$key.'.min.js'], $name); } // example.md5name.js => example.md5name.min.js diff --git a/src/app/code/community/Luigifab/Minifier/Model/Observer.php b/src/app/code/community/Luigifab/Minifier/Model/Observer.php index 1e74331..5768c8e 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://github.com/luigifab/openmage-minifier @@ -74,6 +74,7 @@ protected function searchCurrentLocale(array $locales, string $result = 'en_US') // recherche des préférences dans HTTP_ACCEPT_LANGUAGE // https://stackoverflow.com/a/33748742 + // no mb_functions for locale codes if (!empty(getenv('HTTP_ACCEPT_LANGUAGE'))) { $codes = array_reduce( diff --git a/src/app/code/community/Luigifab/Minifier/controllers/DebugController.php b/src/app/code/community/Luigifab/Minifier/controllers/DebugController.php index ab8ca4f..9b8b7a3 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://github.com/luigifab/openmage-minifier @@ -55,11 +55,11 @@ protected function formatData(array $files) { if (($file['media'] != 'virtual') && is_file($src)) { - $md5Name = substr(md5($src), 0, 10); - $md5Data = substr(md5_file($src), 0, 10); + $md5name = substr(md5($src), 0, 10); // not mb_substr + $md5data = substr(md5_file($src), 0, 10); // not mb_substr $data[$nkey]['dst_link'] = ''.str_replace( - [$md5Name, $md5Data], [''.$md5Name.'', ''.$md5Data.''], $dst + [$md5name, $md5data], [''.$md5name.'', ''.$md5data.''], $dst ).''; } diff --git a/src/app/code/community/Luigifab/Minifier/etc/config.xml b/src/app/code/community/Luigifab/Minifier/etc/config.xml index 6ba2430..8a7e2f4 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 @@