From 37c7902879efcfb790a09b6f5060ffe9ebb2228a Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 29 Mar 2017 15:44:07 +0200 Subject: [PATCH] fixes #471, launch check for new version on page_tail --- include/config_default.inc.php | 10 ++++++++++ include/page_tail.php | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 54dc27734..edf2e1276 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -276,6 +276,16 @@ $conf['ext_imagick_dir'] = ''; // are array(5,10,20,50,'all') but you can set any other numeric value. $conf['comments_page_nb_comments'] = 10; +// how often should we check for new versions of Piwigo on piwigo.org? In +// seconds. The check is made only if there are visits on Piwigo. +// 0 to disable. +$conf['update_notify_check_period'] = 24*60*60; + +// how often should be remind of new versions available? For example a first +// notification was sent on May 5th 2017 for 2.9.1, after how many seconds +// we send it again? 0 to disable. +$conf['update_notify_reminder_period'] = 7*24*60*60; + // +-----------------------------------------------------------------------+ // | email | // +-----------------------------------------------------------------------+ diff --git a/include/page_tail.php b/include/page_tail.php index 82420ffc9..a6ef06379 100644 --- a/include/page_tail.php +++ b/include/page_tail.php @@ -39,6 +39,31 @@ if (!is_a_guest()) ); } +//--------------------------------------------------------- update notification +if ($conf['update_notify_check_period'] > 0) +{ + $check_for_updates = false; + if (isset($conf['update_notify_last_check'])) + { + if (strtotime($conf['update_notify_last_check']) < strtotime($conf['update_notify_check_period'].' seconds ago')) + { + $check_for_updates = true; + } + } + else + { + $check_for_updates = true; + } + + if ($check_for_updates) + { + include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); + include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php'); + $updates = new updates(); + $updates->notify_piwigo_new_versions(); + } +} + //------------------------------------------------------------- generation time $debug_vars = array();