2007-05-12 17:56:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
2008-07-21 17:06:35 +00:00
|
|
|
* Delete archived (deleted from public) revisions from the database
|
2007-05-12 17:56:09 +00:00
|
|
|
*
|
2009-08-02 19:35:17 +00:00
|
|
|
* 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
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup Maintenance
|
2007-05-12 17:56:09 +00:00
|
|
|
* @author Aaron Schulz
|
|
|
|
|
* Shamelessly stolen from deleteOldRevisions.php by Rob Church :)
|
|
|
|
|
*/
|
|
|
|
|
|
2010-05-22 16:50:39 +00:00
|
|
|
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
|
|
|
|
|
require_once( dirname( __FILE__ ) . '/deleteArchivedRevisions.inc' );
|
2007-05-12 17:56:09 +00:00
|
|
|
|
2009-08-02 19:35:17 +00:00
|
|
|
class DeleteArchivedRevisions extends Maintenance {
|
|
|
|
|
public function __construct() {
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->mDescription = "Deletes all archived revisions\nThese revisions will no longer be restorable";
|
|
|
|
|
$this->addOption( 'delete', 'Performs the deletion' );
|
|
|
|
|
}
|
2007-05-12 17:56:09 +00:00
|
|
|
|
2010-05-22 16:50:39 +00:00
|
|
|
public function handleOutput( $str ) {
|
|
|
|
|
$this->output( $str );
|
2010-02-25 04:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
2009-08-02 19:35:17 +00:00
|
|
|
public function execute() {
|
|
|
|
|
$this->output( "Delete archived revisions\n\n" );
|
|
|
|
|
# Data should come off the master, wrapped in a transaction
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( $this->hasOption( 'delete' ) ) {
|
|
|
|
|
DeleteArchivedRevisionsImplementation::doDelete( $this );
|
2009-08-02 19:35:17 +00:00
|
|
|
} else {
|
2010-02-25 04:37:21 +00:00
|
|
|
$dbw = wfGetDB( DB_MASTER );
|
2009-08-02 19:35:17 +00:00
|
|
|
$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" );
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-05-12 17:56:09 +00:00
|
|
|
}
|
|
|
|
|
|
2009-08-02 19:35:17 +00:00
|
|
|
$maintClass = "DeleteArchivedRevisions";
|
2011-01-13 22:58:55 +00:00
|
|
|
require_once( RUN_MAINTENANCE_IF_MAIN );
|