Commit c57754c0 authored by merlinofchaos's avatar merlinofchaos

#254895: Add form to clean up Views 1 tables.

parent 5d7fb1dd
......@@ -70,6 +70,7 @@ Views 2.x-dev
o #512650 by sdboyer: Multiple many to one arguments on the same relationship were not relationship safe.
o #536994 by dboulet: Store result in variables for use in unformatted style.
o #458194 by voxpelli: Add first and last row classes to table style.
o #254895: Add form to clean up Views 1 tables.
Views 2.6
Bugs fixed:
......
......@@ -67,9 +67,59 @@ function views_ui_admin_convert() {
}
$output = t('The table below lists Views version 1 views that are stored in the database. You can either convert them to work in Views version 2, or delete them. The views are convertible only if there is no Views 2 view with the same name.');
$output .= theme('table', $header, $i);
$output .= drupal_get_form('views_ui_convert_cleanup_form');
return $output;
}
/**
* Provide form to clean up Views 1 tables.
*/
function views_ui_convert_cleanup_form() {
$form['verify'] = array(
'#type' => 'checkbox',
'#title' => t('Remove all Views 1 tables'),
'#description' => t('Check this box and then click clean up to drop all Views 1 tables. Warning: this operation will not be reversible! Do this only if you are sure you no longer need this data.'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Clean up'),
);
return $form;
}
function views_ui_convert_cleanup_form_submit($form, $form_state) {
if (empty($form_state['values']['verify'])) {
drupal_set_message('Please check the box to verify you want to destroy your Views 1 table data.');
return;
}
$ret = array();
if (db_table_exists('view_view')) {
db_drop_table($ret, 'view_view');
}
if (db_table_exists('view_sort')) {
db_drop_table($ret, 'view_sort');
}
if (db_table_exists('view_argument')) {
db_drop_table($ret, 'view_argument');
}
if (db_table_exists('view_tablefield')) {
db_drop_table($ret, 'view_tablefield');
}
if (db_table_exists('view_filter')) {
db_drop_table($ret, 'view_filter');
}
if (db_table_exists('view_exposed_filter')) {
db_drop_table($ret, 'view_exposed_filter');
}
drupal_set_message(t('All Views 1 tables have been removed.'));
}
/**
* Page callback for the tools - Views 1 convert page
*/
......
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