X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FdeleteArchivedRevisions.php;h=0faa0abbff4878e0a52c6d8cdbbbaed820df4237;hb=7ec47052c6c38f7ba2b2f561624a97246475739b;hp=98e4aff6e3673cc4a4532404c01085c02550b5dc;hpb=a1c51e18af85a9ac464c5b555921e58ec422cd11;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/deleteArchivedRevisions.php b/maintenance/deleteArchivedRevisions.php index 98e4aff6e3..0faa0abbff 100644 --- a/maintenance/deleteArchivedRevisions.php +++ b/maintenance/deleteArchivedRevisions.php @@ -23,7 +23,8 @@ * Shamelessly stolen from deleteOldRevisions.php by Rob Church :) */ -require_once( "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 );