r104469 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104468‎ | r104469 | r104470 >
Date:19:07, 28 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Add a subscriber to the new API hook APIGetDescription to display some user information at the top of the help page, notifying that the ApiSandbox extension is installed

Using a slightly ugly format - index.php?title=Special:ApiSandbox

If anyone has any ways to get it to display nicer... (/wiki/Special:ApiSandbox etc)
Modified paths:
  • /trunk/extensions/ApiSandbox/ApiSandbox.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ApiSandbox/ApiSandbox.php
@@ -3,8 +3,6 @@
44 * API sandbox extension. Initial author Max Semenik, based on idea by Salil P. A.
55 * License: WTFPL 2.0
66 */
7 -
8 -
97 $wgExtensionCredits['other'][] = array(
108 'path' => __FILE__,
119 'name' => 'ApiSandbox',
@@ -38,3 +36,26 @@
3937 'parentheses',
4038 ),
4139 );
 40+
 41+$wgHooks['APIGetDescription'][] = 'efASAPIGetDescription';
 42+
 43+/**
 44+ * @param $module ApiBase
 45+ * @param $desc array
 46+ * @return bool
 47+ */
 48+function efASAPIGetDescription( &$module, &$desc ) {
 49+ if ( !$module instanceof ApiMain ) {
 50+ return true;
 51+ }
 52+
 53+ $desc[] = 'The ApiSandbox extension is installed on this wiki, it adds a graphical interface to using the MediaWiki Api.';
 54+ $desc[] = 'It is helpful for new users, allowing request debugging without any extra tools.';
 55+ $desc[] = 'See index.php?title=Special:ApiSandbox';
 56+
 57+ // Append some more whitespace for ApiMain
 58+ for ( $i = 0; $i < 3; $i++ ) {
 59+ $desc[] = '';
 60+ }
 61+ return true;
 62+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r104472Follow-up r104469: use standard URL builders to make it work on weird setupsmaxsem19:25, 28 November 2011

Status & tagging log