Commit 17907c45 authored by mikeytown2's avatar mikeytown2

#896448 by martinjbaker: add option to clear cache file immediately in rules.

parent 3e9b4671
......@@ -27,8 +27,9 @@ function boost_rules_action_info() {
* Clears a page from the Boost cache
*/
function boost_rules_action_clear_page($page, $settings) {
if (boost_is_cached($path)) {
boost_cache_expire_derivative(array($page));
if (file_exists(boost_file_path($page, FALSE))) {
$expire_now = $settings['expire_now'];
boost_cache_expire_derivative(array($page), $expire_now, $expire_now);
if (BOOST_VERBOSE >= 5) {
watchdog('boost', 'Rules flushed !page from static page cache.', array('!page' => $page));
}
......@@ -47,4 +48,10 @@ function boost_rules_action_clear_page_form($settings, &$form) {
'#default_value' => $settings['page'],
'#description' => t('The short URL of the page to clear from the Boost cache.'),
);
$form['settings']['expire_now'] = array(
'#type' => 'checkbox',
'#title' => t('Clear cache file(s) immediately.'),
'#default_value' => $settings['expire_now'],
'#description' => t('If unchecked, cache file(s) will be cleared on the next cron run.'),
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment