In a theme there is a function for cache and I am getting warnings.
$options = array('compress' => true); $parser = new Less_Parser($options); $update_cache = !file_exists($cache_file); $vars = ra_get_less_variables(); if (!$update_cache) { $cacheData = unserialize(file_get_contents($cache_file)); foreach ($cacheData['files'] as $file => $fileData) { if ($fileData['filemtime'] < filemtime($file)) { $update_cache = true; break; } } }
$options = array('compress' => true);
$parser = new Less_Parser($options);
$update_cache = !file_exists($cache_file);
$vars = ra_get_less_variables();
if (!$update_cache) {
$cacheData = unserialize(file_get_contents($cache_file));
foreach ($cacheData['files'] as $file => $fileData) {
if ($fileData['filemtime'] < filemtime($file)) {
$update_cache = true;
break;
}
The line with the warning (PHP Warning: filemtime(): stat failed) is:
How can I fix this?
Thank you.
Check if the file actually exists:
if (!file_exists($file) or $fileData['filemtime'] < filemtime($file)) { $update_cache = true; break; }
Welcome to the Q&A site for Question2Answer.
If you have a question about Q2A, please ask here, in English.
To report a bug, please create a new issue on Github or ask a question here with the bug tag.
If you just want to try Q2A, please use the demo site.