X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Fcache%2FLinkBatch.php;h=5dc81101b031aef8d344e85d52ae34204f5c084d;hb=3071f1fad720f1773864621158a0c59b73124896;hp=d98888f0b013e32a65a6a91b46d6d2012dcfe2e3;hpb=c86d36805ed741ef3ebd0c35f6cd12271c454101;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index d98888f0b0..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 );