Page MenuHomePhabricator

SQL query to get the current number of pending-changes is ran twice per page-view on Special:PendingChanges
Open, Needs TriagePublic

Description

Currently, when loading Special:PendingChanges on a wiki, the COUNT() SQL query to get that wiki's current number of pending changes (executed by PendingChangesPager::getPendingCount) is called twice. This is presumably for the header and footer of the PendingChanges table, due to buildTableCaption being called (with different arguments) from buildTableHeader & from getEndBody.

To avoid an unnecessary additional SQL query, this query should probably only be ran once for each page-view.


(Noticed in the comments of https://gerrit.wikimedia.org/r/c/mediawiki/extensions/FlaggedRevs/+/1219906 for T413016: After removing namespace(s) from $wgFlaggedRevsNamespaces, the count at Special:PendingChanges still includes pages in the removed namespace(s))