From 90904c3418effe790ffa4d656197996b517acb10 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 21 Nov 2019 22:18:42 +0100 Subject: [PATCH] =?UTF-8?q?[9.2.11]=20Option=20de=20mise=20=C3=A0=20jour?= =?UTF-8?q?=20auto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 20 ++++++++++++++++---- core/module/config/config.php | 3 ++- core/module/config/view/index/index.php | 6 +++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/core/core.php b/core/core.php index bf3c4639..9ae3944b 100644 --- a/core/core.php +++ b/core/core.php @@ -1007,6 +1007,14 @@ class common { $this->setData(['core', 'dataVersion', 9210]); $this->saveData(); } + // Version 9.2.11 + if($this->getData(['core', 'dataVersion']) < 9211) { + $autoUpdate= mktime(0, 0, 0); + $this->setData(['core', 'lastAutoUpdate', $autoUpdate]); + $this->setData(['config','autoUpdate', true]); + $this->setData(['core', 'dataVersion', 9211]); + $this->saveData(); + } } } @@ -2492,10 +2500,14 @@ class layout extends common { $rightItems .= '
  • ' . template::ico('brush') . '
  • '; $rightItems .= '
  • ' . template::ico('cog-alt') . '
  • '; // Mise à jour automatique - if(helper::checkNewVersion() ) { - $rightItems .= '
  • ' . template::ico('update colorRed') . '
  • '; - } - // Mise à jour automatique + $lastAutoUpdate = mktime(0, 0, 0); + if( $this->getData(['config','autoUpdate']) && + $lastAutoUpdate > $this->getData(['core','lastAutoUpdate']) + 86400 ) { + $this->setData(['core','lastAutoUpdate',$lastAutoUpdate]); + if ( helper::checkNewVersion() ) { + $rightItems .= '
  • ' . template::ico('update colorRed') . '
  • '; + } + } } $rightItems .= '
  • ' . template::ico('user', 'right') . '' . $this->getUser('firstname') . ' ' . $this->getUser('lastname') . '
  • '; $rightItems .= '
  • ' . template::ico('logout') . '
  • '; diff --git a/core/module/config/config.php b/core/module/config/config.php index 99bc764b..9d1ff8b6 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -290,7 +290,8 @@ class config extends common { 'timezone' => $this->getInput('configTimezone', helper::FILTER_STRING_SHORT, true), 'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true), 'itemsperPage' => $this->getInput('itemsperPage', helper::FILTER_INT,true), - 'legalPageId' => $this->getInput('configLegalPageId') + 'legalPageId' => $this->getInput('configLegalPageId'), + 'autoUpdate' => $this->getInput('configAutoUpdate') ] ]); if(self::$inputNotices === []) { diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index 153f52c5..25a04132 100755 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -92,7 +92,8 @@ 'help' => 'Vérifiez d\'abord que votre serveur l\'autorise : ce n\'est pas le cas chez Free.' ]); ?> - + +
    @@ -165,6 +166,9 @@ $this->getData(['config', 'maintenance']) ]); ?> + $this->getData(['config', 'autoUpdate']) + ]); ?> $this->getData(['config', 'autoBackup']), 'help' => 'Le fichier de données est copié quotidiennement dans le dossier \'site/backup\'. La sauvegarde est conservée pendant 30 jours.'