*/
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' ),
*/
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" );
* 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();
$this->getTemplateInsertions( $existing ) );
# Distant template links
- global $wgGlobalDB;
- if ( $wgGlobalDB ) {
+ global $wgGlobalDatabase;
+ if ( $wgGlobalDatabase ) {
$existing = $this->getDistantExistingTemplates();
$this->incrSharedTableUpdate( 'globaltemplatelinks', 'gtl',
$this->getDistantTemplateDeletions( $existing ),
* @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
);
*/
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();
}