Update wfGetDB calls in Maintenance scripts to use getDB()
[lhc/web/wiklou.git] / maintenance / nukeNS.php
index 479dcf7..0f2dbf6 100644 (file)
@@ -54,8 +54,8 @@ class NukeNS extends Maintenance {
                $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' );
@@ -86,18 +86,18 @@ class NukeNS extends Maintenance {
                                // 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