From ef362bb863eb95d3968a3a1df35562914a1bbdef Mon Sep 17 00:00:00 2001
From: Anika Henke <anika@selfthinker.org>
Date: Sun, 27 Jun 2010 13:58:07 +0100
Subject: [PATCH] moved update message from its own file (conf/msg) into
 doku.php (FS#1800)

---
 conf/msg          | 8 --------
 doku.php          | 3 +++
 inc/infoutils.php | 7 +++----
 3 files changed, 6 insertions(+), 12 deletions(-)
 delete mode 100644 conf/msg

diff --git a/conf/msg b/conf/msg
deleted file mode 100644
index 38bbb133c..000000000
--- a/conf/msg
+++ /dev/null
@@ -1,8 +0,0 @@
-25
-The first line of this file contains a number, indicating
-which notification messages should not be displayed. This
-is the only information sent to dokuwiki.org when the
-updatecheck option is enabled. You usually don't need to
-change this number as it gets updated when you install the
-new release - but to ignore a certain message set its
-number here.
diff --git a/doku.php b/doku.php
index 052e18be9..ddee8c902 100644
--- a/doku.php
+++ b/doku.php
@@ -6,6 +6,9 @@
  * @author     Andreas Gohr <andi@splitbrain.org>
  */
 
+// update message version
+$updateVersion = 25;
+
 //  xdebug_start_profiling();
 
 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
diff --git a/inc/infoutils.php b/inc/infoutils.php
index 87b29d7af..ac6a0a84c 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -16,6 +16,7 @@ if(!defined('DOKU_MESSAGEURL')) define('DOKU_MESSAGEURL','http://update.dokuwiki
 function checkUpdateMessages(){
     global $conf;
     global $INFO;
+    global $updateVersion;
     if(!$conf['updatecheck']) return;
     if($conf['useacl'] && !$INFO['ismanager']) return;
 
@@ -23,12 +24,10 @@ function checkUpdateMessages(){
     $lm = @filemtime($cf);
 
     // check if new messages needs to be fetched
-    if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_CONF.'msg')){
-        $num = @file(DOKU_CONF.'msg');
-        $num = is_array($num) ? (int) $num[0] : 0;
+    if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_INC.'doku.php')){
         $http = new DokuHTTPClient();
         $http->timeout = 8;
-        $data = $http->get(DOKU_MESSAGEURL.$num);
+        $data = $http->get(DOKU_MESSAGEURL.$updateVersion);
         io_saveFile($cf,$data);
     }else{
         $data = io_readFile($cf);
-- 
GitLab