summaryrefslogtreecommitdiff
path: root/maintenance/deleteArchivedRevisions.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
commit6dc1997577fab2c366781fd7048144935afa0012 (patch)
tree8918d28c7ab4342f0738985e37af1dfc42d0e93a /maintenance/deleteArchivedRevisions.php
parent150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff)
parentfa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff)
Merge commit 'fa89acd'
# Conflicts: # .gitignore # extensions/ArchInterWiki.sql
Diffstat (limited to 'maintenance/deleteArchivedRevisions.php')
-rw-r--r--maintenance/deleteArchivedRevisions.php28
1 files changed, 15 insertions, 13 deletions
diff --git a/maintenance/deleteArchivedRevisions.php b/maintenance/deleteArchivedRevisions.php
index 30883ba4..9924eb0c 100644
--- a/maintenance/deleteArchivedRevisions.php
+++ b/maintenance/deleteArchivedRevisions.php
@@ -25,7 +25,6 @@
*/
require_once __DIR__ . '/Maintenance.php';
-require_once __DIR__ . '/deleteArchivedRevisions.inc';
/**
* Maintenance script to delete archived (deleted from public) revisions
@@ -41,21 +40,24 @@ 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
- 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" );
+ $dbw = $this->getDB( DB_MASTER );
+
+ if ( !$this->hasOption( 'delete' ) ) {
+ $count = $dbw->selectField( 'archive', 'COUNT(*)', '', __METHOD__ );
+ $this->output( "Found $count revisions to delete.\n" );
$this->output( "Please run the script again with the --delete option "
. "to really delete the revisions.\n" );
+ return;
+ }
+
+ $this->output( "Deleting archived revisions... " );
+ $dbw->delete( 'archive', '*', __METHOD__ );
+ $count = $dbw->affectedRows();
+ $this->output( "done. $count revisions deleted.\n" );
+
+ if ( $count ) {
+ $this->purgeRedundantText( true );
}
}
}