function boost_flush_caches in Boost 7
Same name and namespace in other branches
- 6 boost.module \boost_flush_caches()
Implements hook_flush_caches(). Deletes all static files.
2 calls to boost_flush_caches()
- boost_disable in ./
boost.install - Implements hook_disable().
- boost_drush_cache_clear_all in ./
boost.drush.inc - Clears all Boost cached data.
File
- ./
boost.module, line 397 - Caches generated output as a static file to be served directly from the webserver.
Code
function boost_flush_caches() {
// Remove all files from the cache.
global $_boost;
// This may not have been invoked in hook_init because of the quick
// check to avoid caching requests from the CLI
$_boost = boost_transform_url();
// Since we may want to ignore flushing (boost_ignore_flush), we check to
// see if it was requested by cron
if (function_exists('drush_get_command') && drupal_is_cli()) {
// Cron invoked from Drush.
$command = drush_get_command();
$commands = explode(',', variable_get('boost_cron_drush_commands', BOOST_CRON_DRUSH_COMMANDS));
$cron_invoked = in_array($command['command'], $commands);
}
else {
// Cron invoked by webserver
$cron_invoked = basename($_SERVER['PHP_SELF']) == variable_get('boost_cron_script_name', BOOST_CRON_SCRIPT_NAME);
}
if (isset($_boost['base_dir']) && (!$cron_invoked || variable_get('boost_ignore_flush', BOOST_IGNORE_FLUSH) == FALSE)) {
$count = _boost_rmdir($_boost['base_dir'], TRUE);
watchdog('boost', 'Flushed all files (%count) from static page cache.', array(
'%count' => $count,
), WATCHDOG_NOTICE);
}
}