From: jenkins-bot Date: Fri, 26 Feb 2016 18:13:14 +0000 (+0000) Subject: Merge "Add type hint against LinkTarget" X-Git-Tag: 1.31.0-rc.0~7821 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=40a628a501fc05bb00e834fe359ca4061925f320;hp=-c;p=lhc%2Fweb%2Fwiklou.git Merge "Add type hint against LinkTarget" --- 40a628a501fc05bb00e834fe359ca4061925f320 diff --combined includes/cache/LinkBatch.php index 5dc81101b0,987aa718ee..a60195891f --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@@ -31,14 -31,14 +31,14 @@@ class LinkBatch /** * 2-d array, first index namespace, second index dbkey, value arbitrary */ - public $data = array(); + public $data = []; /** * For debugging which method is using this class. */ protected $caller; - function __construct( $arr = array() ) { + function __construct( $arr = [] ) { foreach ( $arr as $item ) { $this->addObj( $item ); } @@@ -58,12 -58,8 +58,8 @@@ /** * @param LinkTarget $linkTarget */ - public function addObj( $linkTarget ) { - if ( is_object( $linkTarget ) ) { - $this->add( $linkTarget->getNamespace(), $linkTarget->getDBkey() ); - } else { - wfDebug( "Warning: LinkBatch::addObj got invalid LinkTarget object\n" ); - } + public function addObj( LinkTarget $linkTarget ) { + $this->add( $linkTarget->getNamespace(), $linkTarget->getDBkey() ); } /** @@@ -75,7 -71,7 +71,7 @@@ return; } if ( !array_key_exists( $ns, $this->data ) ) { - $this->data[$ns] = array(); + $this->data[$ns] = []; } $this->data[$ns][strtr( $dbkey, ' ', '_' )] = 1; @@@ -147,12 -143,12 +143,12 @@@ */ public function addResultToCache( $cache, $res ) { if ( !$res ) { - return array(); + return []; } // For each returned entry, add it to the list of good links, and remove it from $remaining - $ids = array(); + $ids = []; $remaining = $this->data; foreach ( $res as $row ) { $title = Title::makeTitle( $row->page_namespace, $row->page_title ); @@@ -178,7 -174,7 +174,7 @@@ * @return bool|ResultWrapper */ public function doQuery() { - global $wgContentHandlerUseDB; + global $wgContentHandlerUseDB, $wgPageLanguageUseDB; if ( $this->isEmpty() ) { return false; @@@ -187,15 -183,12 +183,15 @@@ // This is similar to LinkHolderArray::replaceInternal $dbr = wfGetDB( DB_SLAVE ); $table = 'page'; - $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_len', - 'page_is_redirect', 'page_latest' ); + $fields = [ 'page_id', 'page_namespace', 'page_title', 'page_len', + 'page_is_redirect', 'page_latest' ]; if ( $wgContentHandlerUseDB ) { $fields[] = 'page_content_model'; } + if ( $wgPageLanguageUseDB ) { + $fields[] = 'page_lang'; + } $conds = $this->constructSet( 'page', $dbr );