Page MenuHomePhabricator

Parser functions to determine protection status
Closed, ResolvedPublic

Description

Author: derlay-1

Description:
Currently it's not possible for templates like http://en.wikipedia.org/wiki/Template:Deletedpage to find out if they are transcluded on an unprotected page; such pages should probably be put in a specific category so that they are easy to find and fix. This could be done by having variables (maybe called {{EDITPROTECTION}} and {{MOVEPROTECTION}}) which hold the current protection status.


Version: unspecified
Severity: enhancement

Details

Reference
bz9947

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:37 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz9947.
bzimport added a subscriber: Unknown Object (MLST).

titoxd.wikimedia wrote:

That assumes that you know the protection status, which means an extra database query or two on every page view for that particular page.

ais523 wrote:

(In reply to comment #1)

That assumes that you know the protection status, which means an extra database
query or two on every page view for that particular page.

Pages are viewed much more often than they are protected. So the solution would be to cache it the same way as {{CURRENTHOUR}} is cached (i.e. recalculate it every time the page is purged), and to rerender the page when its protection level is changed (which shouldn't cause much extra query load).

derlay-1 wrote:

(In reply to comment #1)

That assumes that you know the protection status, which means an extra database
query or two on every page view for that particular page.

I don't see why it would. Protection status is needed even now for the "edit this page" and "move" links (which are changed to "view source" and removed, respectively, when appropriate), so it should be already available for other uses.

  • Bug 16939 has been marked as a duplicate of this bug. ***

In bug:16939, I indicated that variables {{editprotectionlevel}}
and {{moveprotectionlevel}} returning respectively the edit and move protection
level of a page, 'none', 'autoconfirmed' and 'sysop' would be extremely useful in protection tags. A recurring problem on Wikipedia is that protection tags are present on non-protected pages, because protection expired or it was not removed after unprotection. It is detrimental to anon and new users' editing. Currently, the only option to detect this is to add an expiry to the template, but this is largely unreliable and incomplete. Having those variables would make bots' work much more efficient and we could hide the template when incorrect.

Note that 'edit' and 'move' are just the default protection types. Technically, they can be removed, or added on to, so it would have to be something more generic, like {{PROTECTIONLEVEL:edit}}. I'm not quite sure how it would make work easier for bots, since bots generally read the raw page text or use the API rather than the parsed text, but it would be good for hiding the template.

Done in r45587. Use: {{PROTECTIONLEVEL:edit}} returns the edit protection level for the page its on. Will update documentation on mw.org shortly.

Great, thanks.
Having this variable will also allow to categorize pages with incorrect protection templates in specific maintenance categories that bots can patrol.

Wiki.Melancholie wrote:

*** Bug 11624 has been marked as a duplicate of this bug. ***

I've created a related bug 17354, on a magic word {{PROTECTIONEXPIRY:action}} returning the protection expiry for a given action.