Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -100,6 +100,9 @@ |
101 | 101 | $this->mAllowedGenerators = array_merge($this->mListModuleNames, $this->mPropModuleNames); |
102 | 102 | } |
103 | 103 | |
| 104 | + /** |
| 105 | + * Helper function to append any add-in modules to the list |
| 106 | + */ |
104 | 107 | private static function appendUserModules(&$modules, $newModules) { |
105 | 108 | if (is_array( $newModules )) { |
106 | 109 | foreach ( $newModules as $moduleName => $moduleClass) { |
— | — | @@ -108,6 +111,9 @@ |
109 | 112 | } |
110 | 113 | } |
111 | 114 | |
| 115 | + /** |
| 116 | + * Gets a default slave database connection object |
| 117 | + */ |
112 | 118 | public function getDB() { |
113 | 119 | if (!isset ($this->mSlaveDB)) { |
114 | 120 | $this->profileDBIn(); |
— | — | @@ -132,6 +138,9 @@ |
133 | 139 | return $this->mNamedDB[$name]; |
134 | 140 | } |
135 | 141 | |
| 142 | + /** |
| 143 | + * Gets the set of pages the user has requested (or generated) |
| 144 | + */ |
136 | 145 | public function getPageSet() { |
137 | 146 | return $this->mPageSet; |
138 | 147 | } |
— | — | @@ -381,12 +390,12 @@ |
382 | 391 | */ |
383 | 392 | public function makeHelpMsg() { |
384 | 393 | |
385 | | - // Use parent to make default message for the query module |
386 | | - $msg = parent :: makeHelpMsg(); |
| 394 | + $msg = ''; |
387 | 395 | |
388 | 396 | // Make sure the internal object is empty |
389 | 397 | // (just in case a sub-module decides to optimize during instantiation) |
390 | 398 | $this->mPageSet = null; |
| 399 | + $this->mAllowedGenerators = array(); // Will be repopulated |
391 | 400 | |
392 | 401 | $astriks = str_repeat('--- ', 8); |
393 | 402 | $msg .= "\n$astriks Query: Prop $astriks\n\n"; |
— | — | @@ -396,6 +405,11 @@ |
397 | 406 | $msg .= "\n$astriks Query: Meta $astriks\n\n"; |
398 | 407 | $msg .= $this->makeHelpMsgHelper($this->mQueryMetaModules, 'meta'); |
399 | 408 | |
| 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 | + |
400 | 414 | return $msg; |
401 | 415 | } |
402 | 416 | |
— | — | @@ -413,8 +427,10 @@ |
414 | 428 | $msg2 = $module->makeHelpMsg(); |
415 | 429 | if ($msg2 !== false) |
416 | 430 | $msg .= $msg2; |
417 | | - if ($module instanceof ApiQueryGeneratorBase) |
| 431 | + if ($module instanceof ApiQueryGeneratorBase) { |
| 432 | + $this->mAllowedGenerators[] = $moduleName; |
418 | 433 | $msg .= "Generator:\n This module may be used as a generator\n"; |
| 434 | + } |
419 | 435 | $moduleDscriptions[] = $msg; |
420 | 436 | } |
421 | 437 | |