Index: trunk/phase3/includes/LinksUpdate.php |
— | — | @@ -400,11 +400,11 @@ |
401 | 401 | * @private |
402 | 402 | */ |
403 | 403 | function incrSharedTableUpdate( $table, $prefix, $deletions, $insertions ) { |
404 | | - global $wgWikiID, $wgGlobalDatabase; |
| 404 | + global $wgGlobalDatabase; |
405 | 405 | |
406 | 406 | if ( $wgGlobalDatabase ) { |
407 | 407 | $dbw = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase ); |
408 | | - $where = array( "{$prefix}_from_wiki" => $wgWikiID, |
| 408 | + $where = array( "{$prefix}_from_wiki" => wfWikiID(), |
409 | 409 | "{$prefix}_from_page" => $this->mId |
410 | 410 | ); |
411 | 411 | $baseKey = "{$prefix}_to_wiki"; |
— | — | @@ -472,18 +472,17 @@ |
473 | 473 | * @private |
474 | 474 | */ |
475 | 475 | function getDistantTemplateInsertions( $existing = array() ) { |
476 | | - global $wgWikiID; |
477 | 476 | $arr = array(); |
478 | | - foreach( $this->mDistantTemplates as $wikiid => $templatesToNS ) { |
| 477 | + foreach( $this->mDistantTemplates as $prefix => $templatesToNS ) { |
479 | 478 | 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] ) |
482 | 481 | : $dbkeys; |
483 | | - $interwiki = Interwiki::fetch( $wikiid ); |
| 482 | + $interwiki = Interwiki::fetch( $prefix ); |
484 | 483 | $wikiid = $interwiki->getWikiID(); |
485 | 484 | foreach ( $diffs as $dbk => $id ) { |
486 | 485 | $arr['globaltemplatelinks'][] = array( |
487 | | - 'gtl_from_wiki' => $wgWikiID, |
| 486 | + 'gtl_from_wiki' => wfWikiID(), |
488 | 487 | 'gtl_from_page' => $this->mId, |
489 | 488 | 'gtl_from_namespace' => $this->mTitle->getNamespace(), |
490 | 489 | 'gtl_from_title' => $this->mTitle->getText(), |
— | — | @@ -493,7 +492,7 @@ |
494 | 493 | ); |
495 | 494 | $arr['globalinterwiki'][] = array( |
496 | 495 | 'giw_wikiid' => $wikiid, |
497 | | - 'giw_prefix' => $prefix // FIXME: $prefix ix undefined |
| 496 | + 'giw_prefix' => $prefix, |
498 | 497 | ); |
499 | 498 | $arr['globalnamespaces'][] = array( |
500 | 499 | 'gn_wiki' => wfWikiID( ), |
— | — | @@ -796,14 +795,18 @@ |
797 | 796 | * @private |
798 | 797 | */ |
799 | 798 | function getDistantExistingTemplates() { |
800 | | - global $wgWikiID; |
801 | 799 | global $wgGlobalDatabase; |
802 | 800 | |
803 | 801 | $arr = array(); |
804 | 802 | if ( $wgGlobalDatabase ) { |
805 | 803 | $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 | + ); |
808 | 811 | foreach ( $res as $row ) { |
809 | 812 | if ( !isset( $arr[$row->gtl_to_wiki] ) ) { |
810 | 813 | $arr[$row->gtl_to_wiki] = array(); |
— | — | @@ -813,7 +816,6 @@ |
814 | 817 | } |
815 | 818 | $arr[$row->gtl_to_wiki][$row->gtl_to_namespace][$row->gtl_to_title] = 1; |
816 | 819 | } |
817 | | - $dbr->freeResult( $res ); |
818 | 820 | } |
819 | 821 | return $arr; |
820 | 822 | } |