diff options
author | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-12-09 17:26:28 +0100 |
---|---|---|
committer | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-12-09 17:26:28 +0100 |
commit | 8702de7f7e170bddfdb622c393c3cac3446fd1c5 (patch) | |
tree | c7269ea61f5d4230a6f916dbabee4ce412e0a9fb /inc/infoutils.php | |
parent | 1cc82e5c76ae7fcd646e448404afdc0fd458bf55 (diff) | |
parent | 9a0ca2cfd8ac42895af3be2efbd2cab7e6d33578 (diff) | |
download | rpg-8702de7f7e170bddfdb622c393c3cac3446fd1c5.tar.gz rpg-8702de7f7e170bddfdb622c393c3cac3446fd1c5.tar.bz2 |
Merge remote-tracking branch 'origin/master' into scrutinizerissues
Conflicts:
inc/media.php
inc/plugin.php
inc/template.php
lib/plugins/authplain/_test/escaping.test.php
lib/plugins/syntax.php
Diffstat (limited to 'inc/infoutils.php')
-rw-r--r-- | inc/infoutils.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/inc/infoutils.php b/inc/infoutils.php index 9c297a28d..399963176 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -20,27 +20,28 @@ function checkUpdateMessages(){ if(!$conf['updatecheck']) return; if($conf['useacl'] && !$INFO['ismanager']) return; - $cf = $conf['cachedir'].'/messages.txt'; + $cf = getCacheName($updateVersion, '.updmsg'); $lm = @filemtime($cf); // check if new messages needs to be fetched if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_INC.DOKU_SCRIPT)){ @touch($cf); - dbglog("checkUpdateMessages(): downloading messages.txt"); + dbglog("checkUpdateMessages(): downloading messages to ".$cf); $http = new DokuHTTPClient(); $http->timeout = 12; - $data = $http->get(DOKU_MESSAGEURL.$updateVersion); - if(substr(trim($data), -1) != '%') { - // this doesn't look like one of our messages, maybe some WiFi login interferred - $data = ''; - }else { - io_saveFile($cf,$data); + $resp = $http->get(DOKU_MESSAGEURL.$updateVersion); + if(is_string($resp) && ($resp == "" || substr(trim($resp), -1) == '%')) { + // basic sanity check that this is either an empty string response (ie "no messages") + // or it looks like one of our messages, not WiFi login or other interposed response + io_saveFile($cf,$resp); + } else { + dbglog("checkUpdateMessages(): unexpected HTTP response received"); } }else{ - dbglog("checkUpdateMessages(): messages.txt up to date"); - $data = io_readFile($cf); + dbglog("checkUpdateMessages(): messages up to date"); } + $data = io_readFile($cf); // show messages through the usual message mechanism $msgs = explode("\n%\n",$data); foreach($msgs as $msg){ @@ -113,13 +114,13 @@ function check(){ if ($INFO['isadmin'] || $INFO['ismanager']){ msg('DokuWiki version: '.getVersion(),1); - if(version_compare(phpversion(),'5.2.0','<')){ - msg('Your PHP version is too old ('.phpversion().' vs. 5.2.0+ needed)',-1); + if(version_compare(phpversion(),'5.3.3','<')){ + msg('Your PHP version is too old ('.phpversion().' vs. 5.3.3+ needed)',-1); }else{ msg('PHP version '.phpversion(),1); } } else { - if(version_compare(phpversion(),'5.2.0','<')){ + if(version_compare(phpversion(),'5.3.3','<')){ msg('Your PHP version is too old',-1); } } |