lscache_prestashop
lscache_prestashop copied to clipboard
filesize(): stat failed for /home/XXXXX/cache/litespeedcache/PSf06522bce5bb1ea8f1377da6c45c0544f9faf.data
I used to get this error nearly every day when I clear the cache. The files are always there when I check, but obviously not always.
This stopped the errors:
protected static function getFileContent($filepath) { // if the file isn’t there or isn’t a normal file, bail out quietly if (! is_file($filepath)) { return ''; }
// now we know filesize() won’t blow up
$len = filesize($filepath);
if ($len > 0) {
$h = fopen($filepath, 'rb');
$contents = fread($h, $len);
fclose($h);
return $contents !== false ? $contents : '';
}
return '';
}
I'm running on thirty bees 1.6 (so PS1.6) and php 8.1