diff options
author | Andreas Gohr <andi@splitbrain.org> | 2014-10-14 19:45:21 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2014-10-14 19:45:21 +0200 |
commit | 154f4a0512f12e784544eafcacf0a69cba84855a (patch) | |
tree | add163257c99ac620b56ed52ba9763730a31b2b1 | |
parent | 99aacf951c793054df267753c46b5f86c65bb2f4 (diff) | |
parent | 86c04d87ee7a9a39ec8838fd53e3797f51949719 (diff) | |
download | rpg-154f4a0512f12e784544eafcacf0a69cba84855a.tar.gz rpg-154f4a0512f12e784544eafcacf0a69cba84855a.tar.bz2 |
Merge pull request #895 from projectgus/master
Fix for update messages never completely going away
-rw-r--r-- | inc/infoutils.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/inc/infoutils.php b/inc/infoutils.php index f9ba11560..e2b64d3ca 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -29,18 +29,19 @@ function checkUpdateMessages(){ dbglog("checkUpdateMessages(): downloading messages.txt"); $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); } + $data = io_readFile($cf); // show messages through the usual message mechanism $msgs = explode("\n%\n",$data); foreach($msgs as $msg){ |