Page MenuHomePhabricator

ProtectionFilter::filter should make a single query per task set
Closed, ResolvedPublic

Description

As mentioned in T308008#7938800 the current status quo is the ProtectionFilter is making a SQL query for each task in the task set to know if it is protected or not. This could be improved to make a single query per task set instead.

See review comments in gerrit 793035 and T308008: Number of "found articles" is not matching the real number of articles for more context.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Would it make sense to create a new method in includes/Permissions/RestrictionStore.php like public function getRestrictions( PageIdentity[] $pages, string $action ): array {...} or a different abstraction/approach would fit better?

Yeah, either a new batch interface in RestrictionStore, or just do a raw SQL query in ProtectionFilter (which is less nice but might be less effort).

The ideal approach IMO would be T259346: Add page protection filter to CirrusSearch but that requires work (maybe a lot of work, I'm not really sure) from the Search team. (Adding the filter is simple; adding page protection data to the search index and keeping it up to date, I'm not sure.)

kostajh renamed this task from ProtectionFilter::filter should make a single query per task set. to ProtectionFilter::filter should make a single query per task set.May 31 2022, 3:59 PM
kostajh removed a project: Growth-Team-Filtering.
kostajh subscribed.

(Growth-Team-Filtering is used for hiding stuff from the Growth-Team inbox, to make it more manageable.)

kostajh raised the priority of this task from Low to Medium.Jun 14 2022, 6:23 PM
kostajh added a subscriber: mewoph.

@Sgs should we unassign this one from you in case @mewoph or I have time to pick it up?

I'm also raising the priority of this one, as it is blocking T308008: Number of "found articles" is not matching the real number of articles, which is blocking T305408: Newcomer tasks: deploy AND selection to all wikis.

Sgs removed Sgs as the assignee of this task.Jun 14 2022, 11:37 PM
Sgs claimed this task.

@Sgs should we unassign this one from you in case @mewoph or I have time to pick it up?

Sure

Sgs removed Sgs as the assignee of this task.Jun 14 2022, 11:39 PM

Change 807984 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@master] [WIP] ProtectionFilter: Use single SQL query per task set

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

Change 808069 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@master] ApiQueryGrowthTasks: Use ProtectionFilter

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

Change 807984 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] ProtectionFilter: Use single SQL query per task set

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

Change 808069 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] ApiQueryGrowthTasks: Use ProtectionFilter

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