X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FLinkBatch.php;h=5dc81101b031aef8d344e85d52ae34204f5c084d;hb=16ae4a7a9b7633ce8a54da8eb9ff05b2f51eaa9d;hp=698b3046f34a8f61f11ceb5c85d457d5ae47c247;hpb=bca2d29cbf2d9a9bbebf546e9df2d80131ae5900;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 698b3046f3..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 ); } @@ -56,13 +56,13 @@ class LinkBatch { } /** - * @param Title $title + * @param LinkTarget $linkTarget */ - public function addObj( $title ) { - if ( is_object( $title ) ) { - $this->add( $title->getNamespace(), $title->getDBkey() ); + public function addObj( $linkTarget ) { + if ( is_object( $linkTarget ) ) { + $this->add( $linkTarget->getNamespace(), $linkTarget->getDBkey() ); } else { - wfDebug( "Warning: LinkBatch::addObj got invalid title object\n" ); + wfDebug( "Warning: LinkBatch::addObj got invalid LinkTarget object\n" ); } } @@ -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 ); @@ -231,7 +234,7 @@ class LinkBatch { * Construct a WHERE clause which will match all the given titles. * * @param string $prefix The appropriate table's field name prefix ('page', 'pl', etc) - * @param DatabaseBase $db DatabaseBase object to use + * @param IDatabase $db DatabaseBase object to use * @return string|bool String with SQL where clause fragment, or false if no items. */ public function constructSet( $prefix, $db ) {