r22787 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22786‎ | r22787 | r22788 >
Date:04:41, 6 June 2007
Author:yurik
Status:old
Tags:
Comment:
API: help message fix - bug 10148 generator and/or help page errors
Modified paths:
  • /trunk/phase3/includes/api/ApiQuery.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuery.php
@@ -100,6 +100,9 @@
101101 $this->mAllowedGenerators = array_merge($this->mListModuleNames, $this->mPropModuleNames);
102102 }
103103
 104+ /**
 105+ * Helper function to append any add-in modules to the list
 106+ */
104107 private static function appendUserModules(&$modules, $newModules) {
105108 if (is_array( $newModules )) {
106109 foreach ( $newModules as $moduleName => $moduleClass) {
@@ -108,6 +111,9 @@
109112 }
110113 }
111114
 115+ /**
 116+ * Gets a default slave database connection object
 117+ */
112118 public function getDB() {
113119 if (!isset ($this->mSlaveDB)) {
114120 $this->profileDBIn();
@@ -132,6 +138,9 @@
133139 return $this->mNamedDB[$name];
134140 }
135141
 142+ /**
 143+ * Gets the set of pages the user has requested (or generated)
 144+ */
136145 public function getPageSet() {
137146 return $this->mPageSet;
138147 }
@@ -381,12 +390,12 @@
382391 */
383392 public function makeHelpMsg() {
384393
385 - // Use parent to make default message for the query module
386 - $msg = parent :: makeHelpMsg();
 394+ $msg = '';
387395
388396 // Make sure the internal object is empty
389397 // (just in case a sub-module decides to optimize during instantiation)
390398 $this->mPageSet = null;
 399+ $this->mAllowedGenerators = array(); // Will be repopulated
391400
392401 $astriks = str_repeat('--- ', 8);
393402 $msg .= "\n$astriks Query: Prop $astriks\n\n";
@@ -396,6 +405,11 @@
397406 $msg .= "\n$astriks Query: Meta $astriks\n\n";
398407 $msg .= $this->makeHelpMsgHelper($this->mQueryMetaModules, 'meta');
399408
 409+ // Perform the base call last because the $this->mAllowedGenerators
 410+ // will be updated inside makeHelpMsgHelper()
 411+ // Use parent to make default message for the query module
 412+ $msg = parent :: makeHelpMsg() . $msg;
 413+
400414 return $msg;
401415 }
402416
@@ -413,8 +427,10 @@
414428 $msg2 = $module->makeHelpMsg();
415429 if ($msg2 !== false)
416430 $msg .= $msg2;
417 - if ($module instanceof ApiQueryGeneratorBase)
 431+ if ($module instanceof ApiQueryGeneratorBase) {
 432+ $this->mAllowedGenerators[] = $moduleName;
418433 $msg .= "Generator:\n This module may be used as a generator\n";
 434+ }
419435 $moduleDscriptions[] = $msg;
420436 }
421437

Follow-up revisions

RevisionCommit summaryAuthorDate
r22791Merged revisions 22747-22790 via svnmerge from...david09:21, 6 June 2007

Status & tagging log