Page MenuHomePhabricator

Add more flags to prop=info
Closed, ResolvedPublic

Description

Author: mattj

Description:
Proposed patch

There needs to be a simple (and lightweight) way of getting information on a page, that is easy to parse and only provides key info. Using query with prop=info provides some information, but it is more difficult to parse (structure changes depending on whether it's interwiki etc) and provides information that's not needed for just basic checks.

I mainly wrote this for use in bug 11 or related inter-wiki access, where you only want basic stuff for crafting links, with the URLs for both blue and red links.

This patch adds action=pagestatus, which gives info like whether it exists, whether it's a redirect or interwiki, whether it's readable to the user, and the view and edit URLs. It will follow one layer of interwiki links, but not two (e.g. wikipedia:de:)


Version: 1.14.x
Severity: enhancement

Attached:

Details

Reference
bz15609

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:22 PM
bzimport set Reference to bz15609.

I'm not going to introduce a new module for this, but some of the flags this module provides (external, readable, url, editurl) can be added as options to prop=info. The others (existence and redirect checking) are already done.

Changing bug title to reflect this.

mattj wrote:

How lightweight is prop=info? I was worried that the revision and length related values would be strong on the database (if this is intended to be called by another wiki on a theoretically large number of pages), and how lightweight this is on HTTP (if another wiki wanted to call it). Although with the combining of the pages, HTTP overhead would probably be less.

(In reply to comment #2)

How lightweight is prop=info? I was worried that the revision and length
related values would be strong on the database (if this is intended to be
called by another wiki on a theoretically large number of pages), and how
lightweight this is on HTTP (if another wiki wanted to call it). Although with
the combining of the pages, HTTP overhead would probably be less.

Nothing in the API is hard on the database, because we're well aware of the fact someone could call any query repeatedly with up to 5000 titles. prop=info is one of the more lightweight modules as long as inprop=protection isn't set.

Added inprop=url and inprop=readable in r41261. The rest of the properties from the patch are already available:

  • Non-existent pages have the 'missing' attribute
  • Redirects have the 'redirect' attribute
  • Interwiki titles (external) are in the <interwiki> element