summaryrefslogtreecommitdiff
path: root/maintenance/deleteArchivedRevisions.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /maintenance/deleteArchivedRevisions.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'maintenance/deleteArchivedRevisions.php')
-rw-r--r--maintenance/deleteArchivedRevisions.php33
1 files changed, 10 insertions, 23 deletions
diff --git a/maintenance/deleteArchivedRevisions.php b/maintenance/deleteArchivedRevisions.php
index c3f8bf11..0faa0abb 100644
--- a/maintenance/deleteArchivedRevisions.php
+++ b/maintenance/deleteArchivedRevisions.php
@@ -23,7 +23,8 @@
* Shamelessly stolen from deleteOldRevisions.php by Rob Church :)
*/
-require_once( dirname(__FILE__) . '/Maintenance.php' );
+require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( dirname( __FILE__ ) . '/deleteArchivedRevisions.inc' );
class DeleteArchivedRevisions extends Maintenance {
public function __construct() {
@@ -32,31 +33,17 @@ class DeleteArchivedRevisions extends Maintenance {
$this->addOption( 'delete', 'Performs the deletion' );
}
+ public function handleOutput( $str ) {
+ $this->output( $str );
+ }
+
public function execute() {
$this->output( "Delete archived revisions\n\n" );
# Data should come off the master, wrapped in a transaction
- $dbw = wfGetDB( DB_MASTER );
- if( $this->hasOption('delete') ) {
- $dbw->begin();
-
- $tbl_arch = $dbw->tableName( 'archive' );
-
- # Delete as appropriate
- $this->output( "Deleting archived revisions... " );
- $dbw->query( "TRUNCATE TABLE $tbl_arch" );
-
- $count = $dbw->affectedRows();
- $deletedRows = $count != 0;
-
- $this->output( "done. $count revisions deleted.\n" );
-
- # This bit's done
- # Purge redundant text records
- $dbw->commit();
- if( $deletedRows ) {
- $this->purgeRedundantText( true );
- }
+ if ( $this->hasOption( 'delete' ) ) {
+ DeleteArchivedRevisionsImplementation::doDelete( $this );
} else {
+ $dbw = wfGetDB( DB_MASTER );
$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" );
@@ -65,4 +52,4 @@ class DeleteArchivedRevisions extends Maintenance {
}
$maintClass = "DeleteArchivedRevisions";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );