function delete_all_content_confirm_submit in Delete all 6
Same name and namespace in other branches
- 7 delete_all.module \delete_all_content_confirm_submit()
File
- ./
delete_all.module, line 197
Code
function delete_all_content_confirm_submit($form, &$form_state) {
$types = array();
$form_state['values']['types'] = array();
if (!$form_state['values']['all']) {
$keys = array_filter(array_keys($form_state['values']), "_delete_all_type_keys");
foreach ($keys as $key) {
$types[] = $form_state['values'][$key];
}
}
switch ($form_state['values']['method']) {
case 'normal':
$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_state['values']['all']) {
$result = db_query("SELECT DISTINCT type FROM {node}");
while ($data = db_fetch_object($result)) {
$types[] = $type;
}
}
$count = _delete_all_quick($types);
break;
}
if ($form_state['values']['all']) {
// Delete the URL aliases
db_query("DELETE FROM {url_alias} WHERE src LIKE 'node/%%'");
drupal_set_message(t('All nodes, comments and URL aliases have been deleted. Number of nodes deleted: !count.', array(
'!count' => $count,
)));
}
else {
drupal_set_message(t('Nodes and comments of type @type have been deleted. Number of nodes deleted: !count.', array(
'!count' => $count,
'@type' => implode(', ', $types),
)));
}
drupal_goto('admin');
}