update check: check against last version available on github.com/shaarli/Shaarli

* fixes https://github.com/shaarli/Shaarli/issues/5
This commit is contained in:
nodiscc 2014-10-21 17:54:35 +02:00
parent ccfc046c11
commit b11bc5b6f9

View file

@ -133,7 +133,7 @@ function checkUpdate()
if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL']))) if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL'])))
{ {
$version=shaarli_version; $version=shaarli_version;
list($httpstatus,$headers,$data) = getHTTP('http://sebsauvage.net/files/shaarli_version.txt',2); list($httpstatus,$headers,$data) = getHTTP('https://raw.githubusercontent.com/shaarli/Shaarli/master/shaarli_version.txt',2);
if (strpos($httpstatus,'200 OK')!==false) $version=$data; if (strpos($httpstatus,'200 OK')!==false) $version=$data;
// If failed, never mind. We don't want to bother the user with that. // If failed, never mind. We don't want to bother the user with that.
file_put_contents($GLOBALS['config']['UPDATECHECK_FILENAME'],$version); // touch file date file_put_contents($GLOBALS['config']['UPDATECHECK_FILENAME'],$version); // touch file date