r104731 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104730‎ | r104731 | r104732 >
Date:20:02, 30 November 2011
Author:reedy
Status:ok
Tags:
Comment:
1.18wmf1 MFT r104441, r104470
Modified paths:
  • /branches/wmf/1.18wmf1 (modified) (history)
  • /branches/wmf/1.18wmf1/docs/hooks.txt (modified) (history)
  • /branches/wmf/1.18wmf1/includes (modified) (history)
  • /branches/wmf/1.18wmf1/includes/api (modified) (history)
  • /branches/wmf/1.18wmf1/includes/api/ApiBase.php (modified) (history)
  • /branches/wmf/1.18wmf1/includes/api/ApiParamInfo.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/docs/hooks.txt
@@ -308,12 +308,16 @@
309309 &$resultArr : data in this array will be added to the API result
310310
311311 'APIGetAllowedParams': use this hook to modify a module's parameters.
312 -&$module: Module object
 312+&$module: ApiBase Module object
313313 &$params: Array of parameters
314314
 315+'APIGetDescription': use this hook to modify a module's description
 316+&$module: ApiBase Module object
 317+&$desc: Array of descriptions
 318+
315319 'APIGetParamDescription': use this hook to modify a module's parameter
316320 descriptions.
317 -&$module: Module object
 321+&$module: ApiBase Module object
318322 &$desc: Array of parameter descriptions
319323
320324 'APIQueryAfterExecute': after calling the execute() method of an
Property changes on: branches/wmf/1.18wmf1/docs/hooks.txt
___________________________________________________________________
Modified: svn:mergeinfo
321325 Merged /trunk/phase3/docs/hooks.txt:r104441
Index: branches/wmf/1.18wmf1/includes/api/ApiBase.php
@@ -236,7 +236,7 @@
237237 public function makeHelpMsg() {
238238 static $lnPrfx = "\n ";
239239
240 - $msg = $this->getDescription();
 240+ $msg = $this->getFinalDescription();
241241
242242 if ( $msg !== false ) {
243243
@@ -510,6 +510,7 @@
511511 /**
512512 * Get final list of parameters, after hooks have had a chance to
513513 * tweak it as needed.
 514+ *
514515 * @return array or false
515516 */
516517 public function getFinalParams() {
@@ -519,8 +520,9 @@
520521 }
521522
522523 /**
523 - * Get final description, after hooks have had a chance to tweak it as
 524+ * Get final parameter descriptions, after hooks have had a chance to tweak it as
524525 * needed.
 526+ *
525527 * @return array
526528 */
527529 public function getFinalParamDescription() {
@@ -530,6 +532,18 @@
531533 }
532534
533535 /**
 536+ * Get final module description, after hooks have had a chance to tweak it as
 537+ * needed.
 538+ *
 539+ * @return array
 540+ */
 541+ public function getFinalDescription() {
 542+ $desc = $this->getDescription();
 543+ wfRunHooks( 'APIGetDescription', array( &$this, &$desc ) );
 544+ return $desc;
 545+ }
 546+
 547+ /**
534548 * This method mangles parameter name based on the prefix supplied to the constructor.
535549 * Override this method to change parameter name during runtime
536550 * @param $paramName string Parameter name
Index: branches/wmf/1.18wmf1/includes/api/ApiParamInfo.php
@@ -92,7 +92,7 @@
9393 function getClassInfo( $obj ) {
9494 $result = $this->getResult();
9595 $retval['classname'] = get_class( $obj );
96 - $retval['description'] = implode( "\n", (array)$obj->getDescription() );
 96+ $retval['description'] = implode( "\n", (array)$obj->getFinalDescription() );
9797 $examples = (array)$obj->getExamples();
9898 $retval['examples'] = implode( "\n", $examples );
9999 $retval['version'] = implode( "\n", (array)$obj->getVersion() );
Property changes on: branches/wmf/1.18wmf1/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
100100 Merged /trunk/phase3/includes/api:r104441,104470
Property changes on: branches/wmf/1.18wmf1/includes
___________________________________________________________________
Modified: svn:mergeinfo
101101 Merged /trunk/phase3/includes:r104441,104470
Property changes on: branches/wmf/1.18wmf1
___________________________________________________________________
Modified: svn:mergeinfo
102102 Merged /trunk/phase3:r104441,104470

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104441Added "ApiGetDescription" hookreedy15:33, 28 November 2011
r104470Followup r104441...reedy19:17, 28 November 2011

Status & tagging log