Update wfGetDB calls in Maintenance scripts to use getDB()
[lhc/web/wiklou.git] / maintenance / refreshLinks.php
index 763d97e..a0cd6a9 100644 (file)
@@ -73,10 +73,10 @@ class RefreshLinks extends Maintenance {
        private function doRefreshLinks( $start, $newOnly = false,
                $end = null, $redirectsOnly = false, $oldRedirectsOnly = false
        ) {
-               global $wgParser, $wgUseTidy;
+               global $wgParser;
 
                $reportingInterval = 100;
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = $this->getDB( DB_SLAVE );
 
                if ( $start === null ) {
                        $start = 1;
@@ -88,9 +88,6 @@ class RefreshLinks extends Maintenance {
                # Don't generate extension images (e.g. Timeline)
                $wgParser->clearTagHooks();
 
-               # Don't use HTML tidy
-               $wgUseTidy = false;
-
                $what = $redirectsOnly ? "redirects" : "links";
 
                if ( $oldRedirectsOnly ) {
@@ -195,7 +192,7 @@ class RefreshLinks extends Maintenance {
         */
        private function fixRedirect( $id ) {
                $page = WikiPage::newFromID( $id );
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->getDB( DB_MASTER );
 
                if ( $page === null ) {
                        // This page doesn't exist (any more)
@@ -245,13 +242,8 @@ class RefreshLinks extends Maintenance {
                        return;
                }
 
-               $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
-
                $updates = $content->getSecondaryDataUpdates( $page->getTitle() );
                DataUpdate::runUpdates( $updates );
-
-               $dbw->commit( __METHOD__ );
        }
 
        /**
@@ -270,7 +262,7 @@ class RefreshLinks extends Maintenance {
        ) {
                wfWaitForSlaves();
                $this->output( "Deleting illegal entries from the links tables...\n" );
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = $this->getDB( DB_SLAVE );
                do {
                        // Find the start of the next chunk. This is based only
                        // on existent page_ids.
@@ -310,8 +302,8 @@ class RefreshLinks extends Maintenance {
         * @param int $batchSize The size of deletion batches
         */
        private function dfnCheckInterval( $start = null, $end = null, $batchSize = 100 ) {
-               $dbw = wfGetDB( DB_MASTER );
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbw = $this->getDB( DB_MASTER );
+               $dbr = $this->getDB( DB_SLAVE );
 
                $linksTables = array( // table name => page_id field
                        'pagelinks' => 'pl_from',