You are here

function delete_all_drush_delete in Delete all 6

Same name and namespace in other branches
  1. 7 delete_all.drush.inc \delete_all_drush_delete()

Drush callback to delete content

1 string reference to 'delete_all_drush_delete'
delete_all_drush_command in ./delete_all.drush.inc
Implementation of hook_drush_command().

File

./delete_all.drush.inc, line 33
delete all Drush command

Code

function delete_all_drush_delete() {
  $types = func_get_args();
  if ($types) {
    print "Deleted " . _delete_all_normal(FALSE, $types) . " nodes\n";
  }
  else {
    print "Content types and number of nodes:\n";

    // This should be refactored back into delete_all_content
    $result = db_query("SELECT type, COUNT(*) AS num FROM {node} GROUP BY type");
    $count = array();
    while ($data = db_fetch_object($result)) {
      $count[$data->type] = $data->num;
    }
    foreach (node_get_types() as $type => $info) {
      print $info->type . ' ' . ($count[$type] + 0) . "\n";
    }
  }
}