Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -147,6 +147,13 @@ |
148 | 148 | public function getPageSet() { |
149 | 149 | return $this->mPageSet; |
150 | 150 | } |
| 151 | + |
| 152 | + /** |
| 153 | + * Get the array mapping module names to class names |
| 154 | + */ |
| 155 | + function getModules() { |
| 156 | + return array_merge($this->mQueryPropModules, $this->mQueryListModules, $this->mQueryMetaModules); |
| 157 | + } |
151 | 158 | |
152 | 159 | /** |
153 | 160 | * Query execution happens in the following steps: |
Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -570,6 +570,13 @@ |
571 | 571 | protected function addFormat( $fmtName, $fmtClass ) { |
572 | 572 | $this->mFormats[$fmtName] = $fmtClass; |
573 | 573 | } |
| 574 | + |
| 575 | + /** |
| 576 | + * Get the array mapping module names to class names |
| 577 | + */ |
| 578 | + function getModules() { |
| 579 | + return $this->mModules; |
| 580 | + } |
574 | 581 | } |
575 | 582 | |
576 | 583 | /** |
Index: trunk/phase3/includes/api/ApiParamInfo.php |
— | — | @@ -43,30 +43,35 @@ |
44 | 44 | $result = $this->getResult();
|
45 | 45 | $r = array();
|
46 | 46 | if(is_array($params['modules']))
|
| 47 | + {
|
| 48 | + $modArr = $this->getMain()->getModules();
|
47 | 49 | foreach($params['modules'] as $m)
|
48 | 50 | {
|
49 | | - $className = "Api$m";
|
50 | | - if(!class_exists($className))
|
| 51 | + if(!isset($modArr[$m]))
|
51 | 52 | {
|
52 | | - $mods[$m] = array('missing' => '');
|
| 53 | + $r['modules'][$m] = array('missing' => '');
|
53 | 54 | continue;
|
54 | 55 | }
|
55 | | - $obj = new $className($this->getMain(), $m);
|
| 56 | + $obj = new $modArr[$m]($this->getMain(), $m);
|
56 | 57 | $r['modules'][$m] = $this->getClassInfo($obj);
|
57 | 58 | }
|
| 59 | + }
|
58 | 60 | if(is_array($params['querymodules']))
|
| 61 | + {
|
| 62 | + $queryObj = new ApiQuery($this->getMain(), 'query');
|
| 63 | + $qmodArr = $queryObj->getModules();
|
59 | 64 | foreach($params['querymodules'] as $qm)
|
60 | 65 | {
|
61 | | - $className = "ApiQuery$qm";
|
62 | | - if(!class_exists($className))
|
| 66 | + if(!isset($qmodArr[$qm]))
|
63 | 67 | {
|
64 | | - $qmods[$qm] = array('missing' => '');
|
| 68 | + $r['querymodules'][$qm] = array('missing' => '');
|
65 | 69 | continue;
|
66 | 70 | }
|
67 | | - $obj = new $className($this, $qm);
|
| 71 | + $obj = new $qmodArr[$qm]($this, $qm);
|
68 | 72 | $r['querymodules'][$qm] = $this->getClassInfo($obj);
|
69 | 73 | }
|
70 | | - $result->addValue( null, $this->getModuleName(), $r );
|
| 74 | + }
|
| 75 | + $result->addValue(null, $this->getModuleName(), $r);
|
71 | 76 | }
|
72 | 77 |
|
73 | 78 | function getClassInfo($obj)
|