diff --git a/CHANGES.md b/CHANGES.md index 7c2ef9fd..9c745409 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,11 @@ # Changelog ## Version 12.2.04 -### Amélioration : -- Prise en charge des mises à jour en ligne +### Améliorations : +- Amélioration de la prise en charge des mises à jour en ligne. +- Activation du bouton de mise à jour dans la barre d'administration lorsque le menu de configuration est ouvert est qu'une mise à jour en ligne est détectée. +### Nouveautés : +- Paramètrage du délai de recherche automatique d'une mise à jour, tous les jours, deux jours, quatre jours, toutes les semaines, tous les mois. ## Version 12.2.03 - Corrections de bugs consécutifs au changement de format de languages.json diff --git a/core/core.php b/core/core.php index 8811f24b..3c29c86b 100644 --- a/core/core.php +++ b/core/core.php @@ -49,15 +49,15 @@ class common // Numéro de version et branche pour l'auto-update const ZWII_VERSION = '12.2.04'; - const ZWII_DATAVERSION = 12000; + const ZWII_DATAVERSION = 12204; // URL autoupdate - const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/'; - const ZWII_UPDATE_CHANNEL = "v12"; + //const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/'; + //const ZWII_UPDATE_CHANNEL = "v12"; // Constantes de test - //const ZWII_UPDATE_URL = 'http://localhost/update/'; - //const ZWII_UPDATE_CHANNEL = "test"; + const ZWII_UPDATE_URL = 'http://localhost/update/'; + const ZWII_UPDATE_CHANNEL = "test"; // URL langues de l'UI en ligne const ZWII_UI_URL = 'https://forge.chapril.org/ZwiiCMS-Team/zwiicms-translations/raw/branch/master/'; @@ -2283,7 +2283,7 @@ class common $this->getData(['config', 'autoUpdate']) ) { if ( - $today > $checkUpdate + 86400 + $today > $checkUpdate + $this->getData(['config', 'autoUpdateDelay', 86400]) ) { // Dernier auto controle $this->setData(['core', 'lastAutoUpdate', $today]); diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 8b1542f7..7a81e776 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -914,3 +914,11 @@ if ($this->getData(['core', 'dataVersion']) < 12000) { // Mise à jour $this->setData(['core', 'dataVersion', 12000]); } + +// Version 12.2.04 +if ($this->getData(['core', 'dataVersion']) < 12204) { + // Valeur par défaut du délai de recherche de mise à joru en ligne + $this->setData(['config', 'autoUpdateDelay', 86400]); + // Mise à jour + $this->setData(['core', 'dataVersion', 12204]); +} \ No newline at end of file diff --git a/core/module/config/config.php b/core/module/config/config.php index cd380dde..8f1a77de 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -189,6 +189,13 @@ class config extends common 'num' => 'Chiffres', 'alpha' => 'Lettres' ]; + public static $updateDelay = [ + 86400 => '1', + 172800 => '2', + 345600 => '4', + 604800 => '7', + 1209600 => '14', + ]; // Langue traduite courante public static $i18nSite = 'fr_FR'; @@ -435,6 +442,7 @@ class config extends common 'proxyType' => $this->getInput('configProxyType'), 'proxyUrl' => $this->getInput('configProxyUrl'), 'proxyPort' => $this->getInput('configProxyPort', helper::FILTER_INT), + 'autoUpdateDelay' => $this->getInput('configAutoUpdateDelay', helper::FILTER_INT), 'social' => [ 'facebookId' => $this->getInput('socialFacebookId'), 'linkedinId' => $this->getInput('socialLinkedinId'), @@ -542,12 +550,30 @@ class config extends common ]); } + // Activation du bouton de mise à jour + if ( + helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL) + && $this->getData(['core', 'updateAvailable']) === false + && $this->getData(['config', 'autoUpdate']) + ) { + $this->setData(['core', 'updateAvailable', true]); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . 'config', + ]); + + } + // Variable de version if (helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL)) { - $this->setData(['core', 'updateAvailable', true]); self::$updateButtonText = helper::translate('Mettre à jour'); } + // Sélecteur de délais, compléter avec la traduction en jours + foreach(self::$updateDelay as $key => $value) { + self::$updateDelay[$key] = $key === 86400 ? $value . ' ' . helper::translate('jour') : $value . ' ' . helper::translate('jours'); + } + // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Configuration'), diff --git a/core/module/config/view/setup/setup.php b/core/module/config/view/setup/setup.php index d11f42bc..3c25a371 100644 --- a/core/module/config/view/setup/setup.php +++ b/core/module/config/view/setup/setup.php @@ -83,11 +83,17 @@
Version installée :
Version en ligne :