Skip to content

Commit

Permalink
Version 4.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
luigifab committed Jan 1, 2023
1 parent 2bc9573 commit 7f3c7d9
Show file tree
Hide file tree
Showing 45 changed files with 291 additions and 222 deletions.
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/versioning (IPv6 is

This repository is a releases mirror. To install the module, please use the composer key available in the documentation.

- Current version: 4.4.3 (07/07/2022)
- Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1
- Current version: 4.5.0 (01/01/2023)
- Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2
- 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created S/30/09/2017
* Updated D/01/10/2017
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Created J/07/02/2013
* Updated V/22/10/2021
* Updated S/03/12/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down Expand Up @@ -39,8 +39,11 @@ public function render(Varien_Data_Form_Element_Abstract $element) {
if ($element->getHtmlId() == 'versioning_downtime_report')
$url = str_replace('?lang', '?demo=1&amp;lang', $url);

return sprintf('<tr class="system-fieldset-sub-head"><td colspan="5"><h4>%s <a href="%s">%s</a></h4></td></tr>',
$element->getData('label'), $url, $this->__('Preview in %s', $this->getLocaleName($locale)));
// getPath PR 2774
$isDefault = !$element->getCanUseWebsiteValue() && !$element->getCanUseDefaultValue();
return sprintf('<tr class="system-fieldset-sub-head"><td colspan="%d"><h4>%s <a href="%s">%s</a></h4></td></tr>',
(empty($element->getPath()) ? ($isDefault ? 4 : 5) : ($isDefault ? 5 : 6)),
$element->getLabel(), $url, $this->__('Preview in %s', $this->getLocaleName($locale)));
}

protected function getLocaleName(string $code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created V/23/05/2014
* Updated V/24/06/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Created S/04/02/2017
* Updated D/20/05/2018
* Updated S/03/12/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand All @@ -20,7 +20,7 @@
class Luigifab_Versioning_Block_Adminhtml_Config_Ip extends Mage_Adminhtml_Block_System_Config_Form_Field {

public function render(Varien_Data_Form_Element_Abstract $element) {
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue()->unsPath();
return parent::render($element);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created V/06/04/2012
* Updated J/30/07/2020
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created V/06/04/2012
* Updated S/19/02/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created S/03/12/2011
* Updated J/08/10/2020
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created S/03/12/2011
* Updated S/19/02/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created L/13/02/2012
* Updated J/25/11/2021
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
8 changes: 4 additions & 4 deletions src/app/code/community/Luigifab/Versioning/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Created S/03/12/2011
* Updated J/30/12/2021
* Updated V/09/12/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down Expand Up @@ -111,7 +111,7 @@ public function getUsername() {
$user = $action->getFullActionName();
// frontend
else
$user = sprintf('frontend %d', Mage::app()->getStore()->getData('code'));
$user = sprintf('frontend %s', Mage::app()->getStore()->getData('code'));

return $user;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/code/community/Luigifab/Versioning/Model/Demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created V/02/11/2012
* Updated D/18/07/2021
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
4 changes: 2 additions & 2 deletions src/app/code/community/Luigifab/Versioning/Model/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created V/03/08/2012
* Updated V/24/06/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Created M/21/01/2020
* Updated D/18/07/2021
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down
27 changes: 14 additions & 13 deletions src/app/code/community/Luigifab/Versioning/Model/Observer.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Created J/31/05/2012
* Updated V/24/06/2022
* Updated L/14/11/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand Down Expand Up @@ -83,23 +83,23 @@ protected function updateTranslations(array $global) {
$value = str_replace('"', '""', trim($value));

// versioning/downtime/*title
if (stripos($key, 'title') !== false) {
if (str_contains($key, 'title')) {

if (!empty($value))
$translations[$locale][] = '"'.$key.'","'.$value.'"';
}
// versioning/downtime/*content
else if (stripos($key, 'content') !== false) {
else if (str_contains($key, 'content')) {

if (!empty($value) && (mb_stripos($value, '<') === 0))
if (!empty($value) && (mb_strpos($value, '<') === 0))
$translations[$locale][] = '"'.$key.'","'.$value.'"';
else if (!empty($value))
$translations[$locale][] = '"'.$key.'","<p>'.str_replace("\n", '<br />', $value).'</p>"';
}
// versioning/downtime/*autoreload
else if (stripos($key, 'autoreload') !== false) {
else if (str_contains($key, 'autoreload')) {

if (!empty($value) && (mb_stripos($value, '[') !== false) && (mb_stripos($value, ']') !== false))
if (!empty($value) && str_contains($value, '[') && str_contains($value, ']'))
$translations[$locale][] = '"'.$key.'","'.str_replace(['[', ']'], ['<span>', '</span>'], $value).'"';
}
}
Expand All @@ -125,15 +125,16 @@ protected function updateDataConfig(array $global) {
if (empty($value))
continue;

if ((stripos($key, '_email') !== false) || (stripos($key, '_custom') !== false))
if (str_contains($key, '_email') || str_contains($key, '_custom'))
$config[] = $key.'='.str_replace('=', '', $value);
}

// sauvegarde des données dans un seul fichier (format CSV)
if (is_file(BP.'/errors/config/config.dat'))
@unlink(BP.'/errors/config/config.dat');
$file = BP.'/errors/config/config.dat';
if (count($config) > 0)
file_put_contents(BP.'/errors/config/config.dat', implode("\n", $config));
file_put_contents($file, implode("\n", $config));
else if (is_file($file))
unlink($file);
}

// byip (error503.ip upgrade.ip report.ip)
Expand All @@ -148,7 +149,7 @@ protected function updateIpConfig(array $global) {
if (empty($value))
continue;

if (stripos($key, '_byip') !== false) {
if (str_contains($key, '_byip')) {
$key = substr($key, 0, strrpos($key, '_'));
$value = array_filter(preg_split('#\s+#', $value));
$config[$key][] = '-'.implode("-\n-", $value).'-';
Expand Down
40 changes: 30 additions & 10 deletions src/app/code/community/Luigifab/Versioning/Model/Scm.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Created M/07/01/2020
* Updated S/09/10/2021
* Updated J/17/11/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/versioning
* Copyright 2011-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://github.com/luigifab/openmage-versioning
*
* This program is free software, you can redistribute it or modify
* it under the terms of the GNU General Public License (GPL) as published
Expand All @@ -29,7 +29,7 @@ public function getType() {

public function isSoftwareInstalled() {

exec($this->getType().' --version', $data, $return);
exec(escapeshellcmd($this->getType()).' --version', $data, $return);

if ($return == 0) {
$data = preg_replace('#[^\d.]#', '', trim(implode($data)));
Expand All @@ -47,23 +47,43 @@ public function getSoftwareVersion() {
return $this->_version;
}

protected function markExcludedFile(string $line, array $excl) {
protected function markExcludedFile(string $line, array $excl, bool $check = false) {

// par min
if (mb_stripos($line, '.min.') !== false && in_array('min', $excl))
if ((mb_stripos($line, '.min.') !== false) && in_array('min', $excl)) {
if ($check)
return true;
$line = str_replace('.min.', '.§{#{§min§}#}§.', $line);
}

// par extension
$ign = mb_strrpos($line, '.');
$ign = mb_substr($line, ($ign > 0) ? $ign + 1 : mb_strrpos($line, '/') + 1);
if (in_array($ign, $excl))
if (in_array($ign, $excl)) {
if ($check)
return true;
$line = str_replace('.'.$ign, '.§{#{§'.$ign.'§}#}§', $line);
}

// par nom de fichier
$ign = mb_substr($line, mb_strrpos($line, '/') + 1);
if (in_array($ign, $excl))
$ign = basename($line);
if (in_array($ign, $excl)) {
$line = str_replace('/'.$ign, '/§{#{§'.$ign.'§}#}§', $line);
if ($check)
return true;
}

// par nom de dossier
$ign = explode('/', $line);
foreach ($ign as $itm) {
$ign = in_array($itm, $excl);
if ($ign) {
if ($check)
return true;
$line = str_replace('/'.$itm.'/', '/§{#{§'.$itm.'§}#}§/', $line);
}
}

return $line;
return $check ? false : $line;
}
}
Loading

0 comments on commit 7f3c7d9

Please sign in to comment.