Updater lock (and fixed)
This commit is contained in:
parent
c223a38433
commit
20e4300580
|
@ -121,11 +121,28 @@ function create_from_opml($opml) {
|
||||||
**/
|
**/
|
||||||
function versionCheck() {
|
function versionCheck() {
|
||||||
$versionfile = 'version';
|
$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) ) {
|
if( file_get_contents($versionfile) != file_get_contents($lastestUrl) ) {
|
||||||
|
file_put_contents($lockfile, 'NEW');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
file_put_contents($lockfile, '.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$update_available = versionCheck();
|
$update_available = versionCheck();
|
||||||
|
@ -565,6 +582,7 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY
|
||||||
|
|
||||||
<?php if( $update_available ) { ?>
|
<?php if( $update_available ) { ?>
|
||||||
<div class="pbloc">
|
<div class="pbloc">
|
||||||
|
<h2>Mise à jour</h2>
|
||||||
<p>
|
<p>
|
||||||
Une mise à jour du Projet Autoblog est disponible ! → <a href="#">Télécharger</a>
|
Une mise à jour du Projet Autoblog est disponible ! → <a href="#">Télécharger</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.3.0-DEV Build 13bd6aa6b2395fdbc815a59850e7b6fd8d07ce31
|
0.3.0-DEV Build 0
|
Loading…
Reference in a new issue