diff --git a/core/class/helper.class.php b/core/class/helper.class.php index 579ef071..98354432 100755 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -131,7 +131,7 @@ class helper { * @return string */ public static function getOnlineVersion() { - return (@file_get_contents('http://zwiicms.com/update/version')); + return (@file_get_contents('http://zwiicms.com/update/'. common::ZWII_UPDATE_CHANNEL . '/version')); } @@ -140,6 +140,7 @@ class helper { * @return bool */ public static function checkNewVersion() { + if($version = helper::getOnlineVersion()) { //return (trim($version) !== common::ZWII_VERSION); return ((version_compare(common::ZWII_VERSION,$version)) === -1); diff --git a/core/core.php b/core/core.php index 9cd6045b..471fde0e 100755 --- a/core/core.php +++ b/core/core.php @@ -36,7 +36,7 @@ class common { const THUMBS_WIDTH = 640; // Numéro de version - const ZWII_VERSION = '10.0.068'; + const ZWII_VERSION = '10.0.069'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; @@ -2383,14 +2383,17 @@ class layout extends common { $rightItems .= '
  • ' . template::ico('brush') . '
  • '; $rightItems .= '
  • ' . template::ico('cog-alt') . '
  • '; // Mise à jour automatique - $lastAutoUpdate = mktime(0, 0, 0); + $lastAutoUpdate = mktime(0, 0, 0); if( $this->getData(['config','autoUpdate']) === true && - $lastAutoUpdate > $this->getData(['core','lastAutoUpdate']) + 86400 ) { - $this->setData(['core','lastAutoUpdate',$lastAutoUpdate]); - if ( helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL) ) { - $rightItems .= '
  • ' . template::ico('update colorRed') . '
  • '; - } - } + $lastAutoUpdate >= $this->getData(['core','lastAutoUpdate']) + 86400 ) { + $this->setData(['core','updateAvailable', true]); + $this->setData(['core','lastAutoUpdate',$lastAutoUpdate]); + } + // Afficher le bouton + if ( $this->getData(['core','updateAvailable']) === true && + $this->getData(['config','autoUpdate']) === true ) { + $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 182c4db1..9cb7d755 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -470,20 +470,6 @@ class config extends common { ]); } - /** - * Mise à jour présente - */ - public function updateOnline() { - // Nouvelle version - self::$newVersion = file_get_contents('http://zwiicms.com/update/' . common::ZWII_UPDATE_CHANNEL . '/version'); - // Valeurs en sortie - $this->addOutput([ - 'notification' => 'Version installée : '. common::ZWII_VERSION . '
    Version de la mise à jour en ligne : '. self::$newVersion , - 'redirect' => helper::baseUrl() . 'config', - 'state' => true - ]); - } - } class configHelper extends helper { diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index 2a6b7b51..a70de35c 100755 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -184,7 +184,7 @@
    -

    Gestion et sauvegarde

    +

    Sauvegardes

    +
    +
    + $this->getData(['config', 'maintenance']) + ]); ?> +
    +
    +
    +
    +
    +
    +
    +
    +

    Mise à jour

    $this->getData(['config', 'autoUpdate']), 'help' => 'Vérification de l\'existence d\'une mise à jour en ligne une fois par jour.' ]); ?> -
    -
    - helper::baseUrl() . 'config/updateOnline', - 'value' => 'Version en ligne' - ]); ?>
    -
    - $this->getData(['config', 'maintenance']) - ]); ?> -
    -
    +
    + ' . common::ZWII_VERSION . ''; + echo '. La version de la mise à jour en ligne est ' . file_get_contents('http://zwiicms.com/update/' . common::ZWII_UPDATE_CHANNEL . '/version') . ''; + ?> +
    +
    diff --git a/core/module/install/install.php b/core/module/install/install.php index 792cb622..ab5b4ecb 100755 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -208,6 +208,8 @@ class install extends common { FILE_APPEND ) !== false); } + // RAZ la mise à jour auto + $this->setData(['core','updateAvailable', false]); // Valeurs en sortie $this->addOutput([ 'display' => self::DISPLAY_JSON, diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index dec77694..8160ebe7 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -4,6 +4,7 @@ class init extends common { 'config' => [ 'analyticsId' => '', 'autoBackup' => true, + 'autoUpdate' => true, 'cookieConsent' => true, 'favicon' => 'favicon.ico', 'homePageId' => 'accueil', @@ -31,6 +32,7 @@ class init extends common { 'lastBackup' => 0, 'lastClearTmp' => 0, 'lastAutoUpdate' => 0, + 'updateAvailable' => false, 'baseUrl' => '' ], 'page' => [