summaryrefslogtreecommitdiff
path: root/maintenance/deleteArchivedRevisions.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /maintenance/deleteArchivedRevisions.php
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'maintenance/deleteArchivedRevisions.php')
-rw-r--r--maintenance/deleteArchivedRevisions.php28
1 files changed, 15 insertions, 13 deletions
diff --git a/maintenance/deleteArchivedRevisions.php b/maintenance/deleteArchivedRevisions.php
index 30883ba4..9924eb0c 100644
--- a/maintenance/deleteArchivedRevisions.php
+++ b/maintenance/deleteArchivedRevisions.php
@@ -25,7 +25,6 @@
*/
require_once __DIR__ . '/Maintenance.php';
-require_once __DIR__ . '/deleteArchivedRevisions.inc';
/**
* Maintenance script to delete archived (deleted from public) revisions
@@ -41,21 +40,24 @@ class DeleteArchivedRevisions extends Maintenance {
$this->addOption( 'delete', 'Performs the deletion' );
}
- public function handleOutput( $str ) {
- $this->output( $str );
- }
-
public function execute() {
- $this->output( "Delete archived revisions\n\n" );
- # Data should come off the master, wrapped in a transaction
- if ( $this->hasOption( 'delete' ) ) {
- DeleteArchivedRevisionsImplementation::doDelete( $this );
- } else {
- $dbw = wfGetDB( DB_MASTER );
- $res = $dbw->selectRow( 'archive', 'COUNT(*) as count', array(), __FUNCTION__ );
- $this->output( "Found {$res->count} revisions to delete.\n" );
+ $dbw = $this->getDB( DB_MASTER );
+
+ if ( !$this->hasOption( 'delete' ) ) {
+ $count = $dbw->selectField( 'archive', 'COUNT(*)', '', __METHOD__ );
+ $this->output( "Found $count revisions to delete.\n" );
$this->output( "Please run the script again with the --delete option "
. "to really delete the revisions.\n" );
+ return;
+ }
+
+ $this->output( "Deleting archived revisions... " );
+ $dbw->delete( 'archive', '*', __METHOD__ );
+ $count = $dbw->affectedRows();
+ $this->output( "done. $count revisions deleted.\n" );
+
+ if ( $count ) {
+ $this->purgeRedundantText( true );
}
}
}