From: Kunal Mehta Date: Fri, 13 May 2016 06:27:24 +0000 (-0700) Subject: LinkHolderArray: Use LinkBatch for generating WHERE in query X-Git-Tag: 1.31.0-rc.0~6982^2~2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=b8c2db06930f0238dee80d2fa1e45da0342f64e7;p=lhc%2Fweb%2Fwiklou.git LinkHolderArray: Use LinkBatch for generating WHERE in query The entire query could be replaced with LinkBatch, but that will require further refactoring. Change-Id: I87cf2a391486e36e73a13baac65d243fc9196b5c --- diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 04b5614be6..1ff49ee18e 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -297,7 +297,9 @@ class LinkHolderArray { $linkcolour_ids = []; # Generate query - $queries = []; + $lb = new LinkBatch(); + $lb->setCaller( __METHOD__ ); + foreach ( $this->internals as $ns => $entries ) { foreach ( $entries as $entry ) { /** @var Title $title */ @@ -325,23 +327,12 @@ class LinkHolderArray { $colours[$pdbk] = 'new'; } else { # Not in the link cache, add it to the query - $queries[$ns][] = $title->getDBkey(); + $lb->addObj( $title ); } } } } - if ( $queries ) { - $where = []; - foreach ( $queries as $ns => $pages ) { - $where[] = $dbr->makeList( - [ - 'page_namespace' => $ns, - 'page_title' => array_unique( $pages ), - ], - LIST_AND - ); - } - + if ( !$lb->isEmpty() ) { $fields = [ 'page_id', 'page_namespace', 'page_title', 'page_is_redirect', 'page_len', 'page_latest' ]; @@ -355,7 +346,7 @@ class LinkHolderArray { $res = $dbr->select( 'page', $fields, - $dbr->makeList( $where, LIST_OR ), + $lb->constructSet( 'page', $dbr ), __METHOD__ );