| Index: trunk/phase3/includes/LinksUpdate.php |
| — | — | @@ -155,8 +155,8 @@ |
| 156 | 156 | $this->getTemplateInsertions( $existing ) ); |
| 157 | 157 | |
| 158 | 158 | # Distant template links |
| 159 | | - global $wgGlobalDB; |
| 160 | | - if ( $wgGlobalDB ) { |
| | 159 | + global $wgGlobalDatabase; |
| | 160 | + if ( $wgGlobalDatabase ) { |
| 161 | 161 | $existing = $this->getDistantExistingTemplates(); |
| 162 | 162 | $this->incrSharedTableUpdate( 'globaltemplatelinks', 'gtl', |
| 163 | 163 | $this->getDistantTemplateDeletions( $existing ), |
| — | — | @@ -400,12 +400,10 @@ |
| 401 | 401 | * @private |
| 402 | 402 | */ |
| 403 | 403 | function incrSharedTableUpdate( $table, $prefix, $deletions, $insertions ) { |
| | 404 | + global $wgWikiID, $wgGlobalDatabase; |
| 404 | 405 | |
| 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 ); |
| 410 | 408 | $where = array( "{$prefix}_from_wiki" => $wgWikiID, |
| 411 | 409 | "{$prefix}_from_page" => $this->mId |
| 412 | 410 | ); |
| — | — | @@ -799,14 +797,14 @@ |
| 800 | 798 | */ |
| 801 | 799 | function getDistantExistingTemplates() { |
| 802 | 800 | global $wgWikiID; |
| 803 | | - global $wgGlobalDB; |
| | 801 | + global $wgGlobalDatabase; |
| 804 | 802 | |
| 805 | 803 | $arr = array(); |
| 806 | | - if ( $wgGlobalDB ) { |
| 807 | | - $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDB ); |
| | 804 | + if ( $wgGlobalDatabase ) { |
| | 805 | + $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); |
| 808 | 806 | $res = $dbr->select( 'globaltemplatelinks', array( 'gtl_to_wiki', 'gtl_to_namespace', 'gtl_to_title' ), |
| 809 | 807 | array( 'gtl_from_wiki' => $wgWikiID, 'gtl_from_page' => $this->mId ), __METHOD__, $this->mOptions ); |
| 810 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| | 808 | + foreach ( $res as $row ) { |
| 811 | 809 | if ( !isset( $arr[$row->gtl_to_wiki] ) ) { |
| 812 | 810 | $arr[$row->gtl_to_wiki] = array(); |
| 813 | 811 | } |
| Index: trunk/phase3/includes/BacklinkCache.php |
| — | — | @@ -180,8 +180,8 @@ |
| 181 | 181 | */ |
| 182 | 182 | public function getDistantTemplateLinks( ) { |
| 183 | 183 | global $wgGlobalDatabase, $wgLocalInterwiki; |
| 184 | | - |
| 185 | | - $dbr = $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); |
| | 184 | + |
| | 185 | + $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); |
| 186 | 186 | $res = $dbr->select( |
| 187 | 187 | array( 'globaltemplatelinks', 'globalinterwiki' ), |
| 188 | 188 | array( 'gtl_from_wiki', 'gtl_from_page', 'gtl_from_title', 'giw_prefix' ), |
| — | — | @@ -303,7 +303,7 @@ |
| 304 | 304 | */ |
| 305 | 305 | public function partition( $table, $batchSize ) { |
| 306 | 306 | |
| 307 | | - // 1) try partition cache ... |
| | 307 | + // 1) try partition cache ... |
| 308 | 308 | |
| 309 | 309 | if ( isset( $this->partitionCache[$table][$batchSize] ) ) { |
| 310 | 310 | wfDebug( __METHOD__ . ": got from partition cache\n" ); |
| — | — | @@ -358,7 +358,7 @@ |
| 359 | 359 | * Partition a DB result with backlinks in it into batches |
| 360 | 360 | * @param $res ResultWrapper database result |
| 361 | 361 | * @param $batchSize integer |
| 362 | | - * @return array @see |
| | 362 | + * @return array @see |
| 363 | 363 | */ |
| 364 | 364 | protected function partitionResult( $res, $batchSize ) { |
| 365 | 365 | $batches = array(); |