3 * Delete one or more revisions by moving them to the archive table.
9 require_once( 'commandLine.inc' );
11 $dbw = wfGetDB( DB_MASTER
);
13 if ( count( $args ) == 0 ) {
14 echo "Usage: php deleteRevision.php <revid> [<revid> ...]\n";
18 echo "Deleting revision(s) " . implode( ',', $args ) . " from ".wfWikiID()."...\n";
21 foreach ( $args as $revID ) {
22 $dbw->insertSelect( 'archive', array( 'page', 'revision' ),
24 'ar_namespace' => 'page_namespace',
25 'ar_title' => 'page_title',
26 'ar_comment' => 'rev_comment',
27 'ar_user' => 'rev_user',
28 'ar_user_text' => 'rev_user_text',
29 'ar_timestamp' => 'rev_timestamp',
30 'ar_minor_edit' => 'rev_minor_edit',
31 'ar_rev_id' => 'rev_id',
32 'ar_text_id' => 'rev_text_id',
38 if ( !$dbw->affectedRows() ) {
39 echo "Revision $revID not found\n";
41 $affected +
= $dbw->affectedRows();
42 $dbw->delete( 'revision', array( 'rev_id' => $revID ) );
46 print "Deleted $affected revisions\n";