Skip to content
Snippets Groups Projects
Commit 0baa731a authored by Earl Miles's avatar Earl Miles
Browse files

#426652: Clear CTools CSS cache during a system cache flush.

parent c383d5ba
No related branches found
No related tags found
No related merge requests found
...@@ -282,3 +282,11 @@ function ctools_preprocess_node(&$vars) { ...@@ -282,3 +282,11 @@ function ctools_preprocess_node(&$vars) {
$vars['template_files'][] = 'node-panel-' . check_plain($vars['node']->panel_identifier); $vars['template_files'][] = 'node-panel-' . check_plain($vars['node']->panel_identifier);
} }
} }
/**
* Ensure the CTools CSS cache is flushed whenever hook_flush_caches is invoked.
*/
function ctools_flush_caches() {
ctools_include('css');
ctools_css_flush_caches();
}
...@@ -154,7 +154,7 @@ function ctools_css_cache($css, $filter = TRUE) { ...@@ -154,7 +154,7 @@ function ctools_css_cache($css, $filter = TRUE) {
file_check_directory($path, FILE_CREATE_DIRECTORY); file_check_directory($path, FILE_CREATE_DIRECTORY);
} }
// @todo Is this slow? DOes it matter if it is? // @todo Is this slow? Does it matter if it is?
$filename = $path . '/' . md5($css) . '.css'; $filename = $path . '/' . md5($css) . '.css';
// This will do renames if the file already exists, ensuring we don't // This will do renames if the file already exists, ensuring we don't
...@@ -528,3 +528,10 @@ function ctools_css_filter_default_allowed_values() { ...@@ -528,3 +528,10 @@ function ctools_css_filter_default_allowed_values() {
); );
} }
/**
* Delegated implementation of hook_flush_caches()
*/
function ctools_css_flush_caches() {
file_scan_directory(file_create_path('ctools/css'), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE);
db_query("TRUNCATE {ctools_css_cache}");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment