Merge "Protected function UploadBase->validateName changed to public"
[lhc/web/wiklou.git] / maintenance / deleteArchivedRevisions.inc
index 36e05fe..dd8e3dd 100644 (file)
@@ -1,7 +1,6 @@
 <?php
-
 /**
- * Delete archived (deleted from public) revisions from the database
+ * Helper methods for the deleteArchivedRevisions.php maintenance script.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
+/**
+ * Helper methods for the deleteArchivedRevisions.php maintenance script.
+ *
+ * @ingroup Maintenance
+ */
 class DeleteArchivedRevisionsImplementation {
 
-       static public function doDelete($output) {
+       /**
+        * 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.
+        */
+       public static function doDelete( $maint ) {
                $dbw = wfGetDB( DB_MASTER );
 
-               $dbw->begin();
+               $dbw->begin( __METHOD__ );
 
                $tbl_arch = $dbw->tableName( 'archive' );
 
                # Delete as appropriate
-               $output->handleOutput( "Deleting archived revisions... " );
-               $dbw->query( "TRUNCATE TABLE $tbl_arch" );
+               $maint->handleOutput( "Deleting archived revisions... " );
+               $dbw->query( "DELETE FROM $tbl_arch" );
 
                $count = $dbw->affectedRows();
                $deletedRows = $count != 0;
 
-               $output->handleOutput( "done. $count revisions deleted.\n" );
+               $maint->handleOutput( "done. $count revisions deleted.\n" );
 
                # This bit's done
                # Purge redundant text records
-               $dbw->commit();
-               if( $deletedRows ) {
-                       $output->purgeRedundantText( true );
+               $dbw->commit( __METHOD__ );
+               if ( $deletedRows ) {
+                       $maint->purgeRedundantText( true );
                }
        }
-}
\ No newline at end of file
+}