Put a cache for noalyss version

This commit is contained in:
Dany wm 2024-02-25 21:45:46 +01:00 committed by sparkyx
parent 39eb388b0b
commit 303edf25a9
2 changed files with 28 additions and 2 deletions

View file

@ -4279,4 +4279,8 @@ function check_password_strength(p_pass_domid,p_result_domid,details)
{ {
alert_box(e.message); alert_box(e.message);
} }
} }
/**
* @brief
*/

View file

@ -102,7 +102,29 @@ if ( $version < DBVERSIONREPO )
if ( $User->isAdmin() == 1) if ( $User->isAdmin() == 1)
{ {
if (SITE_UPDATE !="") { if (SITE_UPDATE !="") {
$update=@file_get_contents(SITE_UPDATE); $file=$_ENV['TMP']."/version_noalyss".domaine;
if (file_exists($file)) {
$date_time=new \DateTime();
$file_tmstamp=filemtime($file);
$delta= $date_time->getTimestamp() - $file_tmstamp;
// 172800 = 2 days in second
if ( $delta > 172800 ) {
$update=@file_get_contents(SITE_UPDATE);
$f_file= fopen($file,"w+");
fwrite($f_file,$update);
fclose($f_file);
} else {
$update=@file_get_contents($file);
}
} else {
$update=@file_get_contents(SITE_UPDATE);
$f_file= fopen($file,"w+");
fwrite($f_file,$update);
fclose($f_file);
}
if ($update > $version_noalyss ) { if ($update > $version_noalyss ) {
echo '<div id="version_div" class="inner_box" style="width:25%;margin-left:10%;margin-top:3px;">'; echo '<div id="version_div" class="inner_box" style="width:25%;margin-left:10%;margin-top:3px;">';
echo '<p class="notice">'; echo '<p class="notice">';