MediaWiki  REL1_20
deleteArchivedRevisions.php
Go to the documentation of this file.
00001 <?php
00027 require_once( __DIR__ . '/Maintenance.php' );
00028 require_once( __DIR__ . '/deleteArchivedRevisions.inc' );
00029 
00036 class DeleteArchivedRevisions extends Maintenance {
00037         public function __construct() {
00038                 parent::__construct();
00039                 $this->mDescription = "Deletes all archived revisions\nThese revisions will no longer be restorable";
00040                 $this->addOption( 'delete', 'Performs the deletion' );
00041         }
00042 
00043         public function handleOutput( $str ) {
00044                 $this->output( $str );
00045         }
00046 
00047         public function execute() {
00048                 $this->output( "Delete archived revisions\n\n" );
00049                 # Data should come off the master, wrapped in a transaction
00050                 if ( $this->hasOption( 'delete' ) ) {
00051                         DeleteArchivedRevisionsImplementation::doDelete( $this );
00052                 } else {
00053                         $dbw = wfGetDB( DB_MASTER );
00054                         $res = $dbw->selectRow( 'archive', 'COUNT(*) as count', array(), __FUNCTION__ );
00055                         $this->output( "Found {$res->count} revisions to delete.\n" );
00056                         $this->output( "Please run the script again with the --delete option to really delete the revisions.\n" );
00057                 }
00058         }
00059 }
00060 
00061 $maintClass = "DeleteArchivedRevisions";
00062 require_once( RUN_MAINTENANCE_IF_MAIN );