Last modified: 2008-03-28 13:13:10 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T15541, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 13541 - Retrieve specialPageAliases through API Query Meta
Retrieve specialPageAliases through API Query Meta
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-28 07:45 UTC by Lars Aronsson
Modified: 2008-03-28 13:13 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Lars Aronsson 2008-03-28 07:45:31 UTC
The MediaWiki API can retrieve metainfo for namespaces and namespacealiases.
It would be nice if it could also retrieve the translated
special page names, called specialPageAliases in the PHP source code.

I suggest this could be implemented as meta=specialpagenames

Today, there is a long list of translated special page names on
http://www.mediawiki.org/wiki/Special_page_names

I'd like that to become part of the functionality specified at
http://www.mediawiki.org/wiki/API:Query_-_Meta

Some of the same phrases are available through Allmessages,
but the special page name 'Whatlinkshere' => array( 'Verweisliste' )
doesn't correspond to

http://de.wikipedia.org/w/api.php?action=query&meta=allmessages&ammessages=Whatlinkshere
which returns the translation "Links auf diese Seite".
Comment 1 Roan Kattouw 2008-03-28 10:58:27 UTC
I don't see why you'd want to use the API for this:

First, the idea of the API is to avoid the UI. When you're using special pages, that means you're using the UI.

Second, this information is very easy to get: do an HTTP HEAD request for http://de.wikipedia.org/wiki/Spezial:Whatlinkshere and you'll receive a 302 to http://de.wikipedia.org/Spezial:Linkliste . The Spezial: prefix is available from meta=siteinfo&siprop=namespaces, or by issuing another HEAD for http://de.wikipedia.org/Special:Whatlinkshere , which will 301 to Spezial:Whatlinkshere.

Third, because of the 301 and 302 mentioned above, a link to http://de.wikipedia.org/wiki/Special:Whatlinkshere will work just fine.

Marking as WONTFIX as I don't really see a use case for this (other than linking to a special page, but then the English names always work as outlined above). Please REOPEN if you do see one that I totally forgot about.
Comment 2 Lars Aronsson 2008-03-28 11:25:40 UTC
Here's my application: I'm analyzing the page view logs published
by Domas Mituzas, http://dammit.lt/wikistats/

These logs contain a mix of URLs in English (e.g. Special:Whatlinkshere)
and the site's own language (e.g. Spezial:Verweisliste).
I want to add these up, as they are just aliases for the same special page.

To get a list of the namespaces and namespacealiases used on the
site (e.g. Spezial = Special and WP = Wikipedia), I can use the API.

To get a list of the specialPageAliases used, I now have to grab
the source code from SVN, guess which version the website runs,
and parse the PHP from there.  It would be more logical that the
list of used specialPageAliases was available from the API.

If this was offered by the API, it would follow the pattern
of namespaces and allmessages.
Comment 3 Roan Kattouw 2008-03-28 11:31:14 UTC
(In reply to comment #2)
> To get a list of the specialPageAliases used, I now have to grab
> the source code from SVN, guess which version the website runs,
> and parse the PHP from there.  It would be more logical that the
> list of used specialPageAliases was available from the API.
> 
> If this was offered by the API, it would follow the pattern
> of namespaces and allmessages.
> 

That is indeed a benign use case in which you'd want to get all the information
at once. I'll go and implement it.
Comment 4 Lars Aronsson 2008-03-28 12:22:54 UTC
It would also be nice to have API access to the value of fallback8bitEncoding,
as part of meta=general I guess. It's kind of related to case="".
Comment 5 Roan Kattouw 2008-03-28 12:50:30 UTC
Bug as reported was fixed in r32538.

(In reply to comment #4)
> It would also be nice to have API access to the value of fallback8bitEncoding,
> as part of meta=general I guess. It's kind of related to case="".
Is that a configuration option? I couldn't find any reference to it on mediawiki.org

Comment 6 Lars Aronsson 2008-03-28 13:06:27 UTC
fallback8bitEncoding is a per language variable defined in
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/messages/MessagesEn.php?view=markup

  $fallback8bitEncoding = 'windows-1252';

and most west European languages (de,fr,sv,no,da,...) have English as fallback,
so they don't need to define this variable anew.

However, Polish does not but gives it a different value,
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/messages/MessagesPl.php?view=markup

  $fallback8bitEncoding = 'iso-8859-2';

Non-ASCII characters are represented as UTF-8 and hex encoded in the URLs.
But if an incoming URL contains hex that is invalid UTF-8,
this is the 8bit encoding that is tried instead.

You can access [[de:Bär]] as
http://de.wikipedia.org/wiki/B%C3%A4r
where %C3%A4r is the correct UTF-8 code for a-umlaut (ä).

but you can also reach this page as
http://de.wikipedia.org/wiki/B%e4r
where %e4 is the ISO 8859-1 (and thus windows-1252) code for a-umlaut (ä).

Again, in my analysis of the log files, I'd like to sum up the number
of page views for these two URLs, since both go to the same page.
Comment 7 Roan Kattouw 2008-03-28 13:13:10 UTC
Thanks, done in r32540.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links