X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fcache%2FLinkBatch.php;h=5dc81101b031aef8d344e85d52ae34204f5c084d;hb=3071f1fad720f1773864621158a0c59b73124896;hp=8f334cc435eb320d0d91307f3bd3e1c14ecbd6f7;hpb=ffacfb7be40454c98ae73f6b92bf9836c68ff53c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 8f334cc435..5dc81101b0 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -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 ); } @@ -75,7 +75,7 @@ class LinkBatch { return; } if ( !array_key_exists( $ns, $this->data ) ) { - $this->data[$ns] = array(); + $this->data[$ns] = []; } $this->data[$ns][strtr( $dbkey, ' ', '_' )] = 1; @@ -147,12 +147,12 @@ class LinkBatch { */ 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 +178,7 @@ class LinkBatch { * @return bool|ResultWrapper */ public function doQuery() { - global $wgContentHandlerUseDB; + global $wgContentHandlerUseDB, $wgPageLanguageUseDB; if ( $this->isEmpty() ) { return false; @@ -187,12 +187,15 @@ class LinkBatch { // 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 );