Skip to content

Instantly share code, notes, and snippets.

@walkah
Created April 13, 2012 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walkah/2379996 to your computer and use it in GitHub Desktop.
Save walkah/2379996 to your computer and use it in GitHub Desktop.
D7 comment remover
<?php
$first_comment = 38898;
$num_delete = 50;
do {
$cids = db_select('comment', 'c')
->fields('c', array('cid'))
->condition('cid', $first_comment, '>=')
->range(0, 50)
->execute()
->fetchCol();
print "deleting ". count($cids). " comments...\n";
comment_delete_multiple($cids);
} while (count($cids) == $num_delete);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment