2 require_once( 'commandLine.inc' );
4 $dbw = wfGetDB( DB_MASTER
);
6 if ( count( $args ) == 0 ) {
7 echo "Usage: php deleteRevision.php <revid> [<revid> ...]\n";
11 echo "Deleting revision(s) " . implode( ',', $args ) . " from ".wfWikiID()."...\n";
14 foreach ( $args as $revID ) {
15 $dbw->insertSelect( 'archive', array( 'page', 'revision' ),
17 'ar_namespace' => 'page_namespace',
18 'ar_title' => 'page_title',
19 'ar_comment' => 'rev_comment',
20 'ar_user' => 'rev_user',
21 'ar_user_text' => 'rev_user_text',
22 'ar_timestamp' => 'rev_timestamp',
23 'ar_minor_edit' => 'rev_minor_edit',
24 'ar_rev_id' => 'rev_id',
25 'ar_text_id' => 'rev_text_id',
31 if ( !$dbw->affectedRows() ) {
32 echo "Revision $revID not found\n";
34 $affected +
= $dbw->affectedRows();
35 $dbw->delete( 'revision', array( 'rev_id' => $revID ) );
39 print "Deleted $affected revisions\n";