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.
Hi,
I've noticed that Boost only unlink files from normal cache directory. I've enabled the Boost_mobile module, but on call boost_expire_cache() the mobile files are stayed.
I've extended the boost module boost_expire_cache() function to support boost_mobile. My Boost module is already support GZIP, this is available also in my code-snippet.
if ($filename && file_exists($filename)) {
if (module_exists('boost_mobile')) {
$normal_dir = boost_get_normal_cache_dir();
$mobile_dir = boost_mobile_get_mobile_cache_dir();
$mobile_filename = str_replace($normal_dir, $mobile_dir, $filename);
}
if (BOOST_GZIP && file_exists($filename.'.gz')) {
unlink($filename.'.gz');
if (isset($mobile_filename) && file_exists($mobile_filename)) {
unlink($mobile_filename.'.gz');
}
}
if (unlink($filename)) {
$extra = '';
if (isset($mobile_filename) && unlink($mobile_filename)) {
$extra = ' (From mobile also)';
}
boost_log('Removed !file from the boost cache.' . $extra, 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 hope it helps somebody.
Comment | File | Size | Author |
---|---|---|---|
#2 | boost_supports_boost_mobile.patch | 1.99 KB | danyg |
Comments
Comment #1
Frank.dev CreditAttribution: Frank.dev commentedWhere should the code be added?
Comment #2
danyg CreditAttribution: danyg commentedSorry my late answer. This snippet is in boost_expire_cache() function around line #398.
I made a patch, I hope it helps.