API: HTMLize and internationalize the help, add Special:ApiHelp
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 16 Sep 2014 17:54:01 +0000 (13:54 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 10 Oct 2014 14:46:39 +0000 (10:46 -0400)
commitdf457f3809f5bbd0a0887a70f299403fc7322c80
treeb5324b121c793619b2b63f05d1c508605fefa7a9
parentb022afc009b8460e6a5f72653a1fd6021a68f67f
API: HTMLize and internationalize the help, add Special:ApiHelp

The existing API help, formatted as basically a plain-text document
embedded in XML and with a little bolding and a few links
syntax-highlighted in after the fact, works ok for experienced programmers
but isn't at all newbie-friendly. Further, all the help is hard-coded in
English, which isn't very friendly to non-English speakers.

So let's rewrite it. The help text is now obtained from i18n messages
and output in HTML, with the default display consisting of help for a
single module with links to help for other modules. This, of course,
necessitates deprecating many of the existing help-related methods and
hooks and replacing them with new ones, but backwards compatibility is
maintained for almost everything.

At the same time, action=paraminfo also needs to support the
'description' and other help-related fields being output in wikitext or
HTML, and I11cb063d (to access all modules via the 'modules' parameter
instead of having 'modules', 'formatmodules', 'querymodules', and so on)
is folded in.

And we also add Special:ApiHelp. When directly accessed, it simply
redirects to api.php with appropriate parameters. But it's also
transcludable to allow up-to-date API help text to be included within
the on-wiki documentation.

Note this patch doesn't actually add i18n messages for any API modules
besides ApiMain and ApiHelp. That will come in a followup patch, but for
the moment the backwards-compatibility code handles them nicely.

While we're messing with the documentation, we may as well add the
"internal" flag requested in bug 62905 (although the 'includeinternal'
parameter it also requests doesn't make much sense anymore) and a
"deprecated" flag that's needed by several modules now.

Bug: 30936
Bug: 38126
Bug: 42343
Bug: 45641
Bug: 62905
Bug: 63211
Change-Id: Ib14c00df06d85c2f6364d83b2b10ce34c7f513cc
32 files changed:
RELEASE-NOTES-1.25
docs/hooks.txt
includes/AutoLoader.php
includes/DefaultSettings.php
includes/api/ApiBase.php
includes/api/ApiFormatBase.php
includes/api/ApiFormatDbg.php
includes/api/ApiFormatDump.php
includes/api/ApiFormatJson.php
includes/api/ApiFormatTxt.php
includes/api/ApiFormatWddx.php
includes/api/ApiFormatYaml.php
includes/api/ApiHelp.php
includes/api/ApiMain.php
includes/api/ApiParamInfo.php
includes/api/ApiParse.php
includes/api/ApiQuery.php
includes/api/ApiQueryBase.php
includes/api/ApiTokens.php
includes/api/ApiWatch.php
includes/api/i18n/en.json [new file with mode: 0644]
includes/api/i18n/qqq.json [new file with mode: 0644]
includes/specialpage/SpecialPageFactory.php
includes/specials/SpecialApiHelp.php [new file with mode: 0644]
languages/i18n/en.json
languages/i18n/qqq.json
languages/messages/MessagesEn.php
resources/Resources.php
resources/src/mediawiki/mediawiki.apihelp.css [new file with mode: 0644]
tests/phpunit/includes/api/ApiMainTest.php
tests/phpunit/includes/api/PrefixUniquenessTest.php
tests/phpunit/includes/api/format/ApiFormatTestBase.php