From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- maintenance/deleteArchivedRevisions.php | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'maintenance/deleteArchivedRevisions.php') diff --git a/maintenance/deleteArchivedRevisions.php b/maintenance/deleteArchivedRevisions.php index c3f8bf11..0faa0abb 100644 --- a/maintenance/deleteArchivedRevisions.php +++ b/maintenance/deleteArchivedRevisions.php @@ -23,7 +23,8 @@ * Shamelessly stolen from deleteOldRevisions.php by Rob Church :) */ -require_once( dirname(__FILE__) . '/Maintenance.php' ); +require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( dirname( __FILE__ ) . '/deleteArchivedRevisions.inc' ); class DeleteArchivedRevisions extends Maintenance { public function __construct() { @@ -32,31 +33,17 @@ 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 - $dbw = wfGetDB( DB_MASTER ); - if( $this->hasOption('delete') ) { - $dbw->begin(); - - $tbl_arch = $dbw->tableName( 'archive' ); - - # Delete as appropriate - $this->output( "Deleting archived revisions... " ); - $dbw->query( "TRUNCATE TABLE $tbl_arch" ); - - $count = $dbw->affectedRows(); - $deletedRows = $count != 0; - - $this->output( "done. $count revisions deleted.\n" ); - - # This bit's done - # Purge redundant text records - $dbw->commit(); - if( $deletedRows ) { - $this->purgeRedundantText( true ); - } + 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" ); $this->output( "Please run the script again with the --delete option to really delete the revisions.\n" ); @@ -65,4 +52,4 @@ class DeleteArchivedRevisions extends Maintenance { } $maintClass = "DeleteArchivedRevisions"; -require_once( DO_MAINTENANCE ); +require_once( RUN_MAINTENANCE_IF_MAIN ); -- cgit v1.2.2