Skip to content

Commit

Permalink
Version 4.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
luigifab committed Oct 10, 2023
1 parent 4b74036 commit f898b6d
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 34 deletions.
1 change: 0 additions & 1 deletion FUNDING.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
14 changes: 0 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/03/03/2018
* Updated S/03/12/2022
* Updated J/21/09/2023
*
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-minifier
Expand All @@ -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), '<br />'], '<tr><td colspan="'.(empty($element->getPath()) ? 4 : 5).'"><code style="display:block; margin:1em 0; padding-left:6px; font-size:0.9em; line-height:1.4em; border-left:3px solid #AAA;"><strong>## THE REQUIRED CONFIGURATION</strong>
return str_replace(
['`', "\n"],
[chr(194).chr(160), '<br />'], // not mb_chr
'<tr><td colspan="'.(empty($element->getPath()) ? 4 : 5).'"><code style="display:block; margin:1em 0; padding-left:6px; font-size:0.9em; line-height:1.4em; border-left:3px solid #AAA;"><strong>## THE REQUIRED CONFIGURATION</strong>
## for apache (virtual host or htaccess)
RewriteRule (.*)skin/.*/favicon.ico $1favicon.ico [L]
Expand Down
17 changes: 10 additions & 7 deletions src/app/code/community/Luigifab/Minifier/Model/Files.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created W/13/04/2016
* Updated V/10/03/2023
* Updated J/05/10/2023
*
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* Copyright 2022-2023 | Fabrice Creuzot <fabrice~cellublue~com>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/app/code/community/Luigifab/Minifier/Model/Observer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/20/06/2015
* Updated D/11/12/2022
* Updated J/21/09/2023
*
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-minifier
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created D/15/11/2020
* Updated J/03/11/2022
* Updated J/21/09/2023
*
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-minifier
Expand Down Expand Up @@ -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'] = '<a href="'.$base.$dst.'">'.str_replace(
[$md5Name, $md5Data], ['<b>'.$md5Name.'</b>', '<b>'.$md5Data.'</b>'], $dst
[$md5name, $md5data], ['<b>'.$md5name.'</b>', '<b>'.$md5data.'</b>'], $dst
).'</a>';
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/code/community/Luigifab/Minifier/etc/config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Created L/27/06/2011
* Updated V/08/06/2023
* Updated J/21/09/2023
*
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-minifier
Expand All @@ -20,7 +20,7 @@
<config>
<modules>
<Luigifab_Minifier>
<version>4.5.2</version>
<version>4.5.3</version>
</Luigifab_Minifier>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/14/04/2018
* Updated V/02/06/2023
* Updated J/21/09/2023
*
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-minifier
Expand All @@ -28,12 +28,19 @@ if (in_array($session, ['db', 'redis']) && $this->helper('core')->isModuleEnable
$session = 'redis';
else if (method_exists($model, 'getInfo') && $model->getInfo())
$session = 'redis';
if ($session == 'redis')
$session .= ' (db:'.((string) Mage::getConfig()->getNode('global/redis_session/db')).')';
}
catch (Throwable $t) { }
}

$cache = (string) Mage::getConfig()->getNode('global/cache/backend');
$cache = (stripos($cache, 'redis') !== false) ? 'redis' : (empty($cache) ? 'files' : $cache);
if ($cache == 'redis')
$cache .= ' (db:'.((string) Mage::getConfig()->getNode('global/cache/backend_options/database')).')';

// ount!!!! ~40ms
$jit = function_exists('opcache_get_status') ? opcache_get_status() : [];
?>

<div class="header-top minifier" style="height:55px; color:white; border:0;">
Expand Down Expand Up @@ -64,6 +71,61 @@ $cache = (stripos($cache, 'redis') !== false) ? 'redis' : (empty($cache) ? 'file
<?php echo implode(' ', array_map(static function ($value) { return number_format($value, 2); }, sys_getloadavg())) ?> //
OpenMage <?php echo Mage::getOpenMageVersion() ?>
// <abbr>PHP</abbr> <?php echo implode('.', array_slice(preg_split('#\D#', PHP_VERSION), 0, 3)) ?>
<?php if (!empty($jit['jit']['enabled']) && !empty($jit = ini_get('opcache.jit')) && (strlen($jit) >= 4)):
if ($jit == 'tracing')
$jit = 1254;
else if ($jit == 'function')
$jit = 1205;
// https://wiki.php.net/rfc/jit#phpini_defaults (23 june 2023)
// opcache.jit - JIT control options, consists of 4 decimal digits, CRTO (Default 1205)
$info = '<abbr title="C - CPU specific optimization flags: ';
if ($jit[0] == '0')
$info .= '0 - none">0';
else if ($jit[0] == '1')
$info .= '1 - enable AVX instruction generation">1';
else
$info .= 'unknown">'.$jit[0];
$info .= '</abbr><abbr title="R - register allocation: ';
if ($jit[1] == '0')
$info .= '0 - don\'t perform register allocation">0';
else if ($jit[1] == '1')
$info .= '1 - use local liner-scan register allocator">1';
else if ($jit[1] == '2')
$info .= '2 - use global liner-scan register allocator">2';
else
$info .= 'unknown">'.$jit[1];
$info .= '</abbr><abbr title="T - JIT trigger: ';
if ($jit[2] == '0')
$info .= '0 - JIT all functions on first script load">0';
else if ($jit[2] == '1')
$info .= '1 - JIT function on first execution">1';
else if ($jit[2] == '2')
$info .= '2 - Profile on first request and compile hot functions on second request">2';
else if ($jit[2] == '3')
$info .= '3 - Profile on the fly and compile hot functions">3';
else if ($jit[2] == '4')
$info .= '4 - Compile functions with @jit tag in doc-comments">4';
else
$info .= 'unknown">'.$jit[2];
$info .= '</abbr><abbr title="O - Optimization level: ';
if ($jit[3] == '0')
$info .= '0 - don\'t JIT">0';
else if ($jit[3] == '1')
$info .= '1 - minimal JIT (call standard VM handlers)">1';
else if ($jit[3] == '2')
$info .= '2 - selective VM handler inlining">2';
else if ($jit[3] == '3')
$info .= '3 - optimized JIT based on static type inference of individual function">3';
else if ($jit[3] == '4')
$info .= '4 - optimized JIT based on static type inference and call tree">4';
else if ($jit[3] == '5')
$info .= '5 - optimized JIT based on static type inference and inner procedure analyses">5';
else
$info .= 'unknown">'.$jit[3];
$info .= '</abbr>';
?>
(JIT <?php echo $info ?> <?php echo ini_get('opcache.jit_buffer_size') ?>)
<?php endif ?>
// <abbr><?php echo $this->__('DB') ?></abbr> <?php echo implode('.', array_slice(preg_split('#\D#', $dbVersion), 0, 3)) ?>
<?php if (Mage::getIsDeveloperMode()): ?>
(<?php echo Mage::getConfig()->getNode('global/resources/default_setup/connection/dbname') ?>)
Expand Down

0 comments on commit f898b6d

Please sign in to comment.