Page MenuHomePhabricator

Update ApiQueryConfiguredpages for "Protected pages" mode
Open, Needs TriagePublic

Description

During follow-up to T436001: Dolly Parton High load we wanted to identify high-traffic pages at risk of a similar incident. The machine-readable list=configuredpages API was not available on enwiki, even though Special:StablePages (which was available) reports nearly the same thing in human-readable form.

This has been a long-standing quirk: configuredpages has been registered only when $wgFlaggedRevsProtection is off since it was added in 2011. Protection-based wikis such as enwiki got Special:StablePages but no API equivalent.

More generally, FlaggedRevs carries two near-duplicate implementations of the same report: Special:ConfiguredPages (dewiki, $wgFlaggedRevsProtection = false) and Special:StablePages (enwiki, protection-based). The eventual goal is to deprecate and remove some of the complex functionality of the original dewiki variant, so we'd like to reduce the redundancy by having the dewiki implementations be thin subclasses around the simpler enwiki implementations (rather than adding complexity to the enwiki implementation).

Work items:

  • Make list=configuredpages available in all setups. Protection always makes the stable version the default version, so on those wikis the module matches the Special:StablePages list and the cpdefault filter is hidden.
  • Bug fix: list=configuredpages reported page configurations which had already expired (limited time protection)
  • Reuse the Codex UX work done on Special:ConfiguredPages on Special:StablePages.
  • To reduce unnecessary forking, give the two reports and the API the same filters: add "Indefinite expiry only" to Special:ConfiguredPages and a matching cpindef API parameter.
  • Refactor so Special:ConfiguredPages shares code with Special:StablePages instead of being cut-and-paste copies: ConfiguredPagesPager extends StablePagesPager and ConfiguredPages extends StablePages, each overriding only the dewiki-specific behaviour (which version is the default, and the link to Special:Stabilization). The two dewiki classes drop from ~285 to ~116 lines with no change to the rendered HTML.
  • Add test coverage for the API module and for both pagers, which had none.

Related Objects

Event Timeline

Change #1342313 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] api: Make list=configuredpages available in all setups

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

Change #1343157 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] ApiQueryConfiguredpages: Add test coverage

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

Change #1343158 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] ApiQueryConfiguredpages: Prepare for enabling on protection-based wikis

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

Change #1343159 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] ApiQueryConfiguredpages: Do not report expired configurations

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

Change #1343160 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] StablePagesPager, ConfiguredPagesPager: Add test coverage

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

Change #1343161 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] ConfiguredPagesPager: Inherit from StablePagesPager

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

Change #1343162 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] ConfiguredPages: Add the "Indefinite expiry only" filter

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

Change #1343163 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] StablePages: Use the Codex design system for the filter form

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

Change #1343164 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] ConfiguredPages: Inherit from StablePages

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

Change #1343165 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] ApiQueryConfiguredpages: Add the cpindef parameter

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

Change #1343157 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@master] ApiQueryConfiguredpages: Add test coverage

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