Fix incorrect point if cache file is somehow damaged

https://xetown.com/questions/1736150
This commit is contained in:
Kijin Sung 2023-01-06 18:38:43 +09:00
parent 6f51d0da87
commit 6ce32b612f

View file

@ -48,7 +48,7 @@ class pointModel extends point
if ($point !== null)
{
$exists = true;
return $point;
return parent::$_member_point_cache[$member_srl] = $point;
}
}
@ -57,8 +57,12 @@ class pointModel extends point
$cache_filename = sprintf('%s/%d.cache.txt', $cache_path, $member_srl);
if (!$from_db && file_exists($cache_filename))
{
$exists = true;
return parent::$_member_point_cache[$member_srl] = intval(trim(Rhymix\Framework\Storage::read($cache_filename)));
$point = trim(Rhymix\Framework\Storage::read($cache_filename));
if ($point !== '')
{
$exists = true;
return parent::$_member_point_cache[$member_srl] = intval($point);
}
}
// Get from the DB