From 303edf25a9ce5c2dfa1f6aeebc5cd747f8fe4156 Mon Sep 17 00:00:00 2001 From: Dany wm Date: Sun, 25 Feb 2024 21:45:46 +0100 Subject: [PATCH] Put a cache for noalyss version --- html/js/noalyss_script.js | 6 +++++- html/user_login.php | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 540f0b4aa..9dfd5697c 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -4279,4 +4279,8 @@ function check_password_strength(p_pass_domid,p_result_domid,details) { alert_box(e.message); } -} \ No newline at end of file +} + +/** + * @brief + */ \ No newline at end of file diff --git a/html/user_login.php b/html/user_login.php index 488dffae2..bd29135c8 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -102,7 +102,29 @@ if ( $version < DBVERSIONREPO ) if ( $User->isAdmin() == 1) { 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 ) { echo '
'; echo '

';