fix: update $cacheMRfile path to cache folder

This commit is contained in:
dicobaja 2025-03-19 11:38:12 +07:00
parent 3372da2ac4
commit 4ef054466d
No known key found for this signature in database
GPG Key ID: FFA55C5839E47F31

View File

@ -6,7 +6,11 @@ class graph_monthly_registered_customers
{ {
global $CACHE_PATH,$ui; global $CACHE_PATH,$ui;
$cacheMRfile = File::pathFixer('/monthlyRegistered.temp'); $cacheMRfile = $CACHE_PATH . File::pathFixer('/monthlyRegistered.temp');
//Compatibility for old path
if (file_exists($oldCacheMRfile = str_replace($CACHE_PATH, '', $cacheMRfile))) {
rename($oldCacheMRfile, $cacheMRfile);
}
//Cache for 1 hour //Cache for 1 hour
if (file_exists($cacheMRfile) && time() - filemtime($cacheMRfile) < 3600) { if (file_exists($cacheMRfile) && time() - filemtime($cacheMRfile) < 3600) {
$monthlyRegistered = json_decode(file_get_contents($cacheMRfile), true); $monthlyRegistered = json_decode(file_get_contents($cacheMRfile), true);