r96004 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96003‎ | r96004 | r96005 >
Date:15:58, 1 September 2011
Author:reedy
Status:reverted
Tags:
Comment:
Followup r95396

Fix seemingly merge artefacts to kill $wgWikiID and the undefined $prefix
Modified paths:
  • /trunk/phase3/includes/LinksUpdate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LinksUpdate.php
@@ -400,11 +400,11 @@
401401 * @private
402402 */
403403 function incrSharedTableUpdate( $table, $prefix, $deletions, $insertions ) {
404 - global $wgWikiID, $wgGlobalDatabase;
 404+ global $wgGlobalDatabase;
405405
406406 if ( $wgGlobalDatabase ) {
407407 $dbw = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
408 - $where = array( "{$prefix}_from_wiki" => $wgWikiID,
 408+ $where = array( "{$prefix}_from_wiki" => wfWikiID(),
409409 "{$prefix}_from_page" => $this->mId
410410 );
411411 $baseKey = "{$prefix}_to_wiki";
@@ -472,18 +472,17 @@
473473 * @private
474474 */
475475 function getDistantTemplateInsertions( $existing = array() ) {
476 - global $wgWikiID;
477476 $arr = array();
478 - foreach( $this->mDistantTemplates as $wikiid => $templatesToNS ) {
 477+ foreach( $this->mDistantTemplates as $prefix => $templatesToNS ) {
479478 foreach( $templatesToNS as $ns => $dbkeys ) {
480 - $diffs = isset( $existing[$wikiid] ) && isset( $existing[$wikiid][$ns] )
481 - ? array_diff_key( $dbkeys, $existing[$wikiid][$ns] )
 479+ $diffs = isset( $existing[$prefix] ) && isset( $existing[$prefix][$ns] )
 480+ ? array_diff_key( $dbkeys, $existing[$prefix][$ns] )
482481 : $dbkeys;
483 - $interwiki = Interwiki::fetch( $wikiid );
 482+ $interwiki = Interwiki::fetch( $prefix );
484483 $wikiid = $interwiki->getWikiID();
485484 foreach ( $diffs as $dbk => $id ) {
486485 $arr['globaltemplatelinks'][] = array(
487 - 'gtl_from_wiki' => $wgWikiID,
 486+ 'gtl_from_wiki' => wfWikiID(),
488487 'gtl_from_page' => $this->mId,
489488 'gtl_from_namespace' => $this->mTitle->getNamespace(),
490489 'gtl_from_title' => $this->mTitle->getText(),
@@ -493,7 +492,7 @@
494493 );
495494 $arr['globalinterwiki'][] = array(
496495 'giw_wikiid' => $wikiid,
497 - 'giw_prefix' => $prefix // FIXME: $prefix ix undefined
 496+ 'giw_prefix' => $prefix,
498497 );
499498 $arr['globalnamespaces'][] = array(
500499 'gn_wiki' => wfWikiID( ),
@@ -796,14 +795,18 @@
797796 * @private
798797 */
799798 function getDistantExistingTemplates() {
800 - global $wgWikiID;
801799 global $wgGlobalDatabase;
802800
803801 $arr = array();
804802 if ( $wgGlobalDatabase ) {
805803 $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
806 - $res = $dbr->select( 'globaltemplatelinks', array( 'gtl_to_wiki', 'gtl_to_namespace', 'gtl_to_title' ),
807 - array( 'gtl_from_wiki' => $wgWikiID, 'gtl_from_page' => $this->mId ), __METHOD__, $this->mOptions );
 804+ $res = $dbr->select(
 805+ 'globaltemplatelinks',
 806+ array( 'gtl_to_wiki', 'gtl_to_namespace', 'gtl_to_title' ),
 807+ array( 'gtl_from_wiki' => wfWikiID(), 'gtl_from_page' => $this->mId ),
 808+ __METHOD__,
 809+ $this->mOptions
 810+ );
808811 foreach ( $res as $row ) {
809812 if ( !isset( $arr[$row->gtl_to_wiki] ) ) {
810813 $arr[$row->gtl_to_wiki] = array();
@@ -813,7 +816,6 @@
814817 }
815818 $arr[$row->gtl_to_wiki][$row->gtl_to_namespace][$row->gtl_to_title] = 1;
816819 }
817 - $dbr->freeResult( $res );
818820 }
819821 return $arr;
820822 }

Past revisions this follows-up on

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

Status & tagging log