Index: delete_all.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/delete_all/delete_all.module,v retrieving revision 1.1.2.9 diff -u -r1.1.2.9 delete_all.module --- delete_all.module 27 May 2008 22:16:07 -0000 1.1.2.9 +++ delete_all.module 3 Aug 2008 21:05:15 -0000 @@ -1,25 +1,23 @@ 'admin/content/delete_content', - 'title' => t('Delete all content'), - 'description' => t('Delete all nodes and comments on this site. This is useful for development sites, or prior to launching the site. Otherwise it destroys all data on a site.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('delete_all_content'), - 'access' => user_access('administer nodes'), - 'type' => MENU_NORMAL_ITEM); - - $items[] = array( - 'path' => 'admin/user/delete_users', - 'title' => t('Delete all users'), - 'description' => t('Delete all users on this site. This is useful for development sites, or prior to launching the site. Otherwise it destroys all data on a site.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('delete_all_users'), - 'access' => user_access('administer users'), + $items['admin/content/delete_content'] = array( + 'title' => 'Delete all content', + 'description' => 'Delete all nodes and comments on this site. This is useful for development sites, or prior to launching the site. Otherwise it destroys all data on a site.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('delete_all_content'), + 'access arguments' => array('administer nodes'), + 'type' => MENU_NORMAL_ITEM); + + $items['admin/content/delete_users'] = array( + 'title' => 'Delete all users', + 'description' => 'Delete all users on this site. This is useful for development sites, or prior to launching the site. Otherwise it destroys all data on a site.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('delete_all_users'), + 'access arguments' => array('administer users'), 'type' => MENU_NORMAL_ITEM); return $items; @@ -86,10 +84,21 @@ '#type' => 'submit', '#value' => t('Delete'), ); - $form['#submit'] = array('delete_all_content_submit' => array()); + $form['#submit'] = array('delete_all_content_submit'); return $form; } +/** + * Implementation of hook_theme for Drupal 6 theme registry + */ +function delete_all_theme() { + return array( + 'theme_delete_all_checkboxes' => array( + 'arguments' => array('form' => NULL), + ), + ); +} + function theme_delete_all_checkboxes($form) { $total = 0; foreach ($form as $element_id => $element) { @@ -114,24 +123,25 @@ return theme('table', array(), $rows); } -function delete_all_content_submit($form_id, &$form) { +function delete_all_content_submit($form, &$form_state) { $types = array(); - if (!$form['all']) { - foreach ($form['types'] as $type => $checked) { + if (!$form_state['values']['all']) { + foreach ($form_state['values']['types'] as $type => $checked) { if ($checked) { $types[] = $type; } } } - switch ($form['method']) { + + switch ($form_state['values']['method']) { case 'normal': - $count = _delete_all_normal($form['all'], $types); + $count = _delete_all_normal($form_state['values']['all'], $types); break; case 'quick': // the quick method doesn't support an all option, // so just get all the content types and delete all of those - if ($form['all']) { + if ($form_state['values']['all']) { $result = db_query("SELECT DISTINCT type FROM {node}"); while ($data = db_fetch_object($result)) { $types[] = $type; @@ -141,14 +151,10 @@ break; } - if ($form['all']) { + if ($form_state['values']['all']) { // Delete the URL aliases db_query("DELETE FROM {url_alias} WHERE src LIKE 'node/%%'"); - // Reset the sequences - db_query("UPDATE {sequences} SET id = 1 WHERE name = 'node_nid'"); - db_query("UPDATE {sequences} SET id = 1 WHERE name = 'comment_cid'"); - drupal_set_message(t('All nodes, comments and URL aliases have been deleted. Number of nodes deleted: !count.', array('!count' => $count))); } else { @@ -159,7 +165,7 @@ } function _delete_all_normal($all, $types) { - if ($form['all']) { + if ($all) { $result = db_query('SELECT nid FROM {node}'. $where); } else { @@ -269,7 +275,7 @@ 'delete_all_content'); } -function delete_all_users_submit($form_id, &$form) { +function delete_all_users_submit($form, &$form_state) { $result = db_query('SELECT uid FROM {users} WHERE uid > 1'); $count = 0; Index: delete_all.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/delete_all/delete_all.info,v retrieving revision 1.1 diff -u -r1.1 delete_all.info --- delete_all.info 23 Dec 2007 03:22:05 -0000 1.1 +++ delete_all.info 3 Aug 2008 21:05:15 -0000 @@ -2,3 +2,4 @@ name = Delete content and users description = Allows deletion of all nodes, comments and users on a site. Useful for development or prior to launching a site. package = Development +core=6.x \ No newline at end of file