Updater lock (and fixed)

This commit is contained in:
ArthurHoaro 2013-03-01 13:39:33 +01:00
parent c223a38433
commit 20e4300580
2 changed files with 20 additions and 2 deletions

View file

@ -121,11 +121,28 @@ function create_from_opml($opml) {
**/
function versionCheck() {
$versionfile = 'version';
$lastestUrl = 'https://raw.github.com/mitsukarenai/Projet-Autoblog/tree/master/0.3/version';
$lastestUrl = 'https://raw.github.com/mitsukarenai/Projet-Autoblog/master/0.3/version';
$expire = time() - 84600 ; // 23h30 en secondes
$lockfile = '.versionlock';
if (file_exists($lockfile) && filemtime($lockfile) > $expire) {
if( file_get_contents($lockfile) == 'NEW' ) {
// No new version installed
if( filemtime( $lockfile ) > filemtime( $versionfile ) )
return true;
else unlink($lockfile);
}
else return false;
}
if (file_exists($lockfile) && filemtime($lockfile) < $expire) { unlink($lockfile); }
if( file_get_contents($versionfile) != file_get_contents($lastestUrl) ) {
file_put_contents($lockfile, 'NEW');
return true;
}
file_put_contents($lockfile, '.');
return false;
}
$update_available = versionCheck();
@ -565,6 +582,7 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY
<?php if( $update_available ) { ?>
<div class="pbloc">
<h2>Mise à jour</h2>
<p>
Une mise à jour du Projet Autoblog est disponible ! &rarr; <a href="#">Télécharger</a>
</p>

View file

@ -1 +1 @@
0.3.0-DEV Build 13bd6aa6b2395fdbc815a59850e7b6fd8d07ce31
0.3.0-DEV Build 0