MediaWiki  REL1_24
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 =
00040             "Deletes all archived revisions\nThese revisions will no longer be restorable";
00041         $this->addOption( 'delete', 'Performs the deletion' );
00042     }
00043 
00044     public function handleOutput( $str ) {
00045         $this->output( $str );
00046     }
00047 
00048     public function execute() {
00049         $this->output( "Delete archived revisions\n\n" );
00050         # Data should come off the master, wrapped in a transaction
00051         if ( $this->hasOption( 'delete' ) ) {
00052             DeleteArchivedRevisionsImplementation::doDelete( $this );
00053         } else {
00054             $dbw = wfGetDB( DB_MASTER );
00055             $res = $dbw->selectRow( 'archive', 'COUNT(*) as count', array(), __FUNCTION__ );
00056             $this->output( "Found {$res->count} revisions to delete.\n" );
00057             $this->output( "Please run the script again with the --delete option "
00058                 . "to really delete the revisions.\n" );
00059         }
00060     }
00061 }
00062 
00063 $maintClass = "DeleteArchivedRevisions";
00064 require_once RUN_MAINTENANCE_IF_MAIN;