summaryrefslogtreecommitdiff
path: root/maintenance/deleteRevision.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2006-10-11 18:12:39 +0000
committerPierre Schmitz <pierre@archlinux.de>2006-10-11 18:12:39 +0000
commit183851b06bd6c52f3cae5375f433da720d410447 (patch)
treea477257decbf3360127f6739c2f9d0ec57a03d39 /maintenance/deleteRevision.php
MediaWiki 1.7.1 wiederhergestellt
Diffstat (limited to 'maintenance/deleteRevision.php')
-rw-r--r--maintenance/deleteRevision.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/maintenance/deleteRevision.php b/maintenance/deleteRevision.php
new file mode 100644
index 00000000..e7d005b6
--- /dev/null
+++ b/maintenance/deleteRevision.php
@@ -0,0 +1,40 @@
+<?php
+require_once( 'commandLine.inc' );
+
+$dbw =& wfGetDB( DB_MASTER );
+
+if ( count( $args ) == 0 ) {
+ echo "Usage: php deleteRevision.php <revid> [<revid> ...]\n";
+ exit(1);
+}
+
+echo "Deleting revision(s) " . implode( ',', $args ) . " from $wgDBname...\n";
+
+$affected = 0;
+foreach ( $args as $revID ) {
+ $dbw->insertSelect( 'archive', array( 'page', 'revision' ),
+ array(
+ 'ar_namespace' => 'page_namespace',
+ 'ar_title' => 'page_title',
+ 'ar_comment' => 'rev_comment',
+ 'ar_user' => 'rev_user',
+ 'ar_user_text' => 'rev_user_text',
+ 'ar_timestamp' => 'rev_timestamp',
+ 'ar_minor_edit' => 'rev_minor_edit',
+ 'ar_rev_id' => 'rev_id',
+ 'ar_text_id' => 'rev_text_id',
+ ), array(
+ 'rev_id' => $revID,
+ 'page_id = rev_page'
+ ), $fname
+ );
+ if ( !$dbw->affectedRows() ) {
+ echo "Revision $revID not found\n";
+ } else {
+ $affected += $dbw->affectedRows();
+ $dbw->delete( 'revision', array( 'rev_id' => $revID ) );
+ }
+}
+
+print "Deleted $affected revisions\n";
+?>