r95872 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95871‎ | r95872 | r95873 >
Date:15:00, 31 August 2011
Author:reedy
Status:reverted (Comments)
Tags:
Comment:
Followup r95396

Swap $wgGlobalDB for $wgGlobalDatabase
Modified paths:
  • /trunk/phase3/includes/BacklinkCache.php (modified) (history)
  • /trunk/phase3/includes/LinksUpdate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LinksUpdate.php
@@ -155,8 +155,8 @@
156156 $this->getTemplateInsertions( $existing ) );
157157
158158 # Distant template links
159 - global $wgGlobalDB;
160 - if ( $wgGlobalDB ) {
 159+ global $wgGlobalDatabase;
 160+ if ( $wgGlobalDatabase ) {
161161 $existing = $this->getDistantExistingTemplates();
162162 $this->incrSharedTableUpdate( 'globaltemplatelinks', 'gtl',
163163 $this->getDistantTemplateDeletions( $existing ),
@@ -400,12 +400,10 @@
401401 * @private
402402 */
403403 function incrSharedTableUpdate( $table, $prefix, $deletions, $insertions ) {
 404+ global $wgWikiID, $wgGlobalDatabase;
404405
405 - global $wgWikiID;
406 - global $wgGlobalDB;
407 -
408 - if ( $wgGlobalDB ) {
409 - $dbw = wfGetDB( DB_MASTER, array(), $wgGlobalDB );
 406+ if ( $wgGlobalDatabase ) {
 407+ $dbw = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
410408 $where = array( "{$prefix}_from_wiki" => $wgWikiID,
411409 "{$prefix}_from_page" => $this->mId
412410 );
@@ -799,14 +797,14 @@
800798 */
801799 function getDistantExistingTemplates() {
802800 global $wgWikiID;
803 - global $wgGlobalDB;
 801+ global $wgGlobalDatabase;
804802
805803 $arr = array();
806 - if ( $wgGlobalDB ) {
807 - $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDB );
 804+ if ( $wgGlobalDatabase ) {
 805+ $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
808806 $res = $dbr->select( 'globaltemplatelinks', array( 'gtl_to_wiki', 'gtl_to_namespace', 'gtl_to_title' ),
809807 array( 'gtl_from_wiki' => $wgWikiID, 'gtl_from_page' => $this->mId ), __METHOD__, $this->mOptions );
810 - while ( $row = $dbr->fetchObject( $res ) ) {
 808+ foreach ( $res as $row ) {
811809 if ( !isset( $arr[$row->gtl_to_wiki] ) ) {
812810 $arr[$row->gtl_to_wiki] = array();
813811 }
Index: trunk/phase3/includes/BacklinkCache.php
@@ -180,8 +180,8 @@
181181 */
182182 public function getDistantTemplateLinks( ) {
183183 global $wgGlobalDatabase, $wgLocalInterwiki;
184 -
185 - $dbr = $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
 184+
 185+ $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
186186 $res = $dbr->select(
187187 array( 'globaltemplatelinks', 'globalinterwiki' ),
188188 array( 'gtl_from_wiki', 'gtl_from_page', 'gtl_from_title', 'giw_prefix' ),
@@ -303,7 +303,7 @@
304304 */
305305 public function partition( $table, $batchSize ) {
306306
307 - // 1) try partition cache ...
 307+ // 1) try partition cache ...
308308
309309 if ( isset( $this->partitionCache[$table][$batchSize] ) ) {
310310 wfDebug( __METHOD__ . ": got from partition cache\n" );
@@ -358,7 +358,7 @@
359359 * Partition a DB result with backlinks in it into batches
360360 * @param $res ResultWrapper database result
361361 * @param $batchSize integer
362 - * @return array @see
 362+ * @return array @see
363363 */
364364 protected function partitionResult( $res, $batchSize ) {
365365 $batches = array();

Sign-offs

UserFlagDate
Nikerabbitinspected16:25, 31 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95396Merge the iwtransclusion branch back into trunk...reedy13:03, 24 August 2011

Comments

#Comment by 😂 (talk | contribs)   15:14, 31 August 2011

I'm just going on the record, right now, as saying $wgGlobalDatabase has to be the most evil sounding global ever.

Status & tagging log