Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312458

Change subject: Reduce queries in CategoryViewer via addGoodLinkObjFromRow()
......................................................................

Reduce queries in CategoryViewer via addGoodLinkObjFromRow()

Change-Id: Id782b50f166efbee6c9f8b9b263f09fc5fb5e3f2
---
M includes/CategoryViewer.php
1 file changed, 17 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/312458/1

diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php
index a8e988f..53e855b 100644
--- a/includes/CategoryViewer.php
+++ b/includes/CategoryViewer.php
@@ -19,6 +19,7 @@
  *
  * @file
  */
+use MediaWiki\MediaWikiServices;
 
 class CategoryViewer extends ContextSource {
        /** @var int */
@@ -317,10 +318,19 @@
 
                        $res = $dbr->select(
                                [ 'page', 'categorylinks', 'category' ],
-                               [ 'page_id', 'page_title', 'page_namespace', 
'page_len',
-                                       'page_is_redirect', 'cl_sortkey', 
'cat_id', 'cat_title',
-                                       'cat_subcats', 'cat_pages', 'cat_files',
-                                       'cl_sortkey_prefix', 'cl_collation' ],
+                               array_merge(
+                                       LinkCache::getSelectFields(),
+                                       [
+                                               'cl_sortkey',
+                                               'cat_id',
+                                               'cat_title',
+                                               'cat_subcats',
+                                               'cat_pages',
+                                               'cat_files',
+                                               'cl_sortkey_prefix',
+                                               'cl_collation'
+                                       ]
+                               ),
                                array_merge( [ 'cl_to' => 
$this->title->getDBkey() ], $extraConds ),
                                __METHOD__,
                                [
@@ -338,10 +348,13 @@
                        );
 
                        Hooks::run( 'CategoryViewer::doCategoryQuery', [ $type, 
$res ] );
+                       $linkCache = 
MediaWikiServices::getInstance()->getLinkCache();
 
                        $count = 0;
                        foreach ( $res as $row ) {
                                $title = Title::newFromRow( $row );
+                               $linkCache->addGoodLinkObjFromRow( $title, $row 
);
+
                                if ( $row->cl_collation === '' ) {
                                        // Hack to make sure that while 
updating from 1.16 schema
                                        // and db is inconsistent, that the sky 
doesn't fall.

-- 
To view, visit https://gerrit.wikimedia.org/r/312458
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id782b50f166efbee6c9f8b9b263f09fc5fb5e3f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to