From: Sam Reed Date: Wed, 31 Aug 2011 15:00:23 +0000 (+0000) Subject: Followup r95396 X-Git-Tag: 1.31.0-rc.0~27995 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=7268b417d0423aa7ffb31ba214fd5a0560e788f4;p=lhc%2Fweb%2Fwiklou.git Followup r95396 Swap $wgGlobalDB for $wgGlobalDatabase --- diff --git a/includes/BacklinkCache.php b/includes/BacklinkCache.php index 978abecad3..4de4afb15c 100644 --- a/includes/BacklinkCache.php +++ b/includes/BacklinkCache.php @@ -180,8 +180,8 @@ class BacklinkCache { */ public function getDistantTemplateLinks( ) { global $wgGlobalDatabase, $wgLocalInterwiki; - - $dbr = $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); + + $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); $res = $dbr->select( array( 'globaltemplatelinks', 'globalinterwiki' ), array( 'gtl_from_wiki', 'gtl_from_page', 'gtl_from_title', 'giw_prefix' ), @@ -303,7 +303,7 @@ class BacklinkCache { */ public function partition( $table, $batchSize ) { - // 1) try partition cache ... + // 1) try partition cache ... if ( isset( $this->partitionCache[$table][$batchSize] ) ) { wfDebug( __METHOD__ . ": got from partition cache\n" ); @@ -358,7 +358,7 @@ class BacklinkCache { * Partition a DB result with backlinks in it into batches * @param $res ResultWrapper database result * @param $batchSize integer - * @return array @see + * @return array @see */ protected function partitionResult( $res, $batchSize ) { $batches = array(); diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index da77601319..72bd2e6db3 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -155,8 +155,8 @@ class LinksUpdate { $this->getTemplateInsertions( $existing ) ); # Distant template links - global $wgGlobalDB; - if ( $wgGlobalDB ) { + global $wgGlobalDatabase; + if ( $wgGlobalDatabase ) { $existing = $this->getDistantExistingTemplates(); $this->incrSharedTableUpdate( 'globaltemplatelinks', 'gtl', $this->getDistantTemplateDeletions( $existing ), @@ -400,12 +400,10 @@ class LinksUpdate { * @private */ function incrSharedTableUpdate( $table, $prefix, $deletions, $insertions ) { + global $wgWikiID, $wgGlobalDatabase; - global $wgWikiID; - global $wgGlobalDB; - - if ( $wgGlobalDB ) { - $dbw = wfGetDB( DB_MASTER, array(), $wgGlobalDB ); + if ( $wgGlobalDatabase ) { + $dbw = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase ); $where = array( "{$prefix}_from_wiki" => $wgWikiID, "{$prefix}_from_page" => $this->mId ); @@ -799,14 +797,14 @@ class LinksUpdate { */ function getDistantExistingTemplates() { global $wgWikiID; - global $wgGlobalDB; + global $wgGlobalDatabase; $arr = array(); - if ( $wgGlobalDB ) { - $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDB ); + if ( $wgGlobalDatabase ) { + $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); $res = $dbr->select( 'globaltemplatelinks', array( 'gtl_to_wiki', 'gtl_to_namespace', 'gtl_to_title' ), array( 'gtl_from_wiki' => $wgWikiID, 'gtl_from_page' => $this->mId ), __METHOD__, $this->mOptions ); - while ( $row = $dbr->fetchObject( $res ) ) { + foreach ( $res as $row ) { if ( !isset( $arr[$row->gtl_to_wiki] ) ) { $arr[$row->gtl_to_wiki] = array(); }