* based on nukePage by Rob Church
*/
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
/**
* Maintenance script that removes pages with only one revision from the
$ns = $this->getOption( 'ns', NS_MEDIAWIKI );
$delete = $this->getOption( 'delete', false );
$all = $this->getOption( 'all', false );
- $dbw = wfGetDB( DB_MASTER );
- $dbw->begin( __METHOD__ );
+ $dbw = $this->getDB( DB_MASTER );
+ $this->beginTransaction( $dbw, __METHOD__ );
$tbl_pag = $dbw->tableName( 'page' );
$tbl_rev = $dbw->tableName( 'revision' );
// I already have the id & revs
if ( $delete ) {
$dbw->query( "DELETE FROM $tbl_pag WHERE page_id = $id" );
- $dbw->commit( __METHOD__ );
+ $this->commitTransaction( $dbw, __METHOD__ );
// Delete revisions as appropriate
$child = $this->runChild( 'NukePage', 'nukePage.php' );
$child->deleteRevisions( $revs );
$this->purgeRedundantText( true );
- $n_deleted ++;
+ $n_deleted++;
}
} else {
$this->output( "skip: " . $title->getPrefixedText() . "\n" );
}
}
- $dbw->commit( __METHOD__ );
+ $this->commitTransaction( $dbw, __METHOD__ );
if ( $n_deleted > 0 ) {
# update statistics - better to decrement existing count, or just count
}
$maintClass = "NukeNS";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;