X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FdeleteArchivedRevisions.inc;h=10bd4cff6e75dd76e76f5324929475b3064140c2;hb=d97cf151d06ed3bdfaf65eb9f0a75a6be8769d37;hp=67e4c5a26175741eb1d757c9d9f83bc7851cc1a1;hpb=087a9f70c5c152b72dc6c539cf64e334a0f2d029;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/deleteArchivedRevisions.inc b/maintenance/deleteArchivedRevisions.inc index 67e4c5a261..10bd4cff6e 100644 --- a/maintenance/deleteArchivedRevisions.inc +++ b/maintenance/deleteArchivedRevisions.inc @@ -1,34 +1,57 @@ begin(); - - $tbl_arch = $dbw->tableName( 'archive' ); - # Delete as appropriate - echo( "Deleting archived revisions..." ); - $dbw->query( "TRUNCATE TABLE $tbl_arch" ); - echo( "done.\n" ); - - $delete = $dbw->affectedRows() != 0; - - # This bit's done - # Purge redundant text records - $dbw->commit(); - if( $delete ) { - PurgeRedundantText( true ); - } -} +class DeleteArchivedRevisionsImplementation { + + /** + * Perform the delete on archived revisions. + + * @param $maint Object An object (typically of class Maintenance) + * that implements two methods: handleOutput() and + * purgeRedundantText(). See Maintenance for a description of + * those methods. + */ + static public function doDelete( $maint ) { + $dbw = wfGetDB( DB_MASTER ); + + $dbw->begin(); + + $tbl_arch = $dbw->tableName( 'archive' ); + + # Delete as appropriate + $maint->handleOutput( "Deleting archived revisions... " ); + $dbw->query( "DELETE FROM $tbl_arch" ); + + $count = $dbw->affectedRows(); + $deletedRows = $count != 0; + + $maint->handleOutput( "done. $count revisions deleted.\n" ); + + # This bit's done + # Purge redundant text records + $dbw->commit(); + if ( $deletedRows ) { + $maint->purgeRedundantText( true ); + } + } +} \ No newline at end of file