Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I frequently see errors like the following when Boost is trying to delete a file that doesn't exist:
unlink(FILENAME_HERE): No such file or directory
The offending code is in boost_expire_cache():
if (unlink($filename)) {
boost_log('Removed !file from the boost cache.', array('!file' => $filename), WATCHDOG_DEBUG);
}
else {
boost_log('Could not delete !file from the boost cache. Check file permissions.', array('!file' => $filename), WATCHDOG_WARNING);
}
I propose simply checking if the file exists before attempting to delete it. If it's not there, that's just fine and no warning needs to be thrown or watchdog message logged.
Comment | File | Size | Author |
---|---|---|---|
#2 | boost-unlink-if-file-exists-2853028-2.patch | 1016 bytes | joelstein |
Comments
Comment #2
joelstein CreditAttribution: joelstein at On Fire Media commentedHere's a patch which uses is_file() to check that the file exists and is a file.