Commit b4f15f71 authored by merlinofchaos's avatar merlinofchaos
Browse files

Clear cache button in tools

parent 8e812250
......@@ -151,5 +151,5 @@ Views --dev
o #115849: Use dedicated cache table for views caching
o New $arg (inline argument) variants: $node, $node-TYPE, $user
o #102489: Allow edit tabs on views (for admins).
o New 'tools' page in UI to clear the views cache.
......@@ -114,6 +114,12 @@ function views_ui_menu($may_cache) {
'callback' => 'views_ui_admin_import_page',
'access' => user_access('administer views'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/build/views/tools',
'title' => t('Tools'),
'callback' => 'drupal_get_form',
'callback arguments' => array('views_ui_admin_tools'),
'access' => user_access('administer views'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/build/views/delete',
'title' => t('Edit view'),
'callback' => 'drupal_get_form',
......@@ -299,6 +305,26 @@ function views_ui_admin_page() {
return $output;
}
function views_ui_admin_tools() {
$form['markup'] = array(
'#value' => t('<p>Occasionally, something or other can cause the Views cache to contain stale data; this is particularly true after module updates and sometimes true after taxonomy and profile updates. If you are having problems with Views creating malformed queries, the first thing you should always do is clear the Views cache to see if that is the problem.</p>'),
);
$form['clear'] = array(
'#type' => 'submit',
'#value' => t('Clear views cache'),
);
return $form;
}
function views_ui_admin_tools_submit($form_id, $form) {
if ($_POST['op'] == t('Clear views cache')) {
views_invalidate_cache();
drupal_set_message("The Views cache has been cleared.");
}
}
/*
* Page to enable a disabled default view
*/
......
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