Index: trunk/phase3/includes/api/ApiQueryLinks.php |
— | — | @@ -73,6 +73,8 @@ |
74 | 74 | if ($this->getPageSet()->getGoodTitleCount() == 0) |
75 | 75 | return; // nothing to do |
76 | 76 | |
| 77 | + $params = $this->extractRequestParams(); |
| 78 | + |
77 | 79 | $this->addFields(array ( |
78 | 80 | $this->prefix . '_from pl_from', |
79 | 81 | $this->prefix . '_namespace pl_namespace', |
— | — | @@ -81,6 +83,7 @@ |
82 | 84 | |
83 | 85 | $this->addTables($this->table); |
84 | 86 | $this->addWhereFld($this->prefix . '_from', array_keys($this->getPageSet()->getGoodTitles())); |
| 87 | + $this->addWhereFld($this->prefix . '_namespace', $params['namespace']); |
85 | 88 | $this->addOption('ORDER BY', str_replace('pl_', $this->prefix . '_', 'pl_from, pl_namespace, pl_title')); |
86 | 89 | |
87 | 90 | $db = $this->getDB(); |
— | — | @@ -131,6 +134,23 @@ |
132 | 135 | $data); |
133 | 136 | } |
134 | 137 | |
| 138 | + protected function getAllowedParams() |
| 139 | + { |
| 140 | + return array( |
| 141 | + 'namespace' => array( |
| 142 | + ApiBase :: PARAM_TYPE => 'namespace', |
| 143 | + ApiBase :: PARAM_ISMULTI => true |
| 144 | + ) |
| 145 | + ); |
| 146 | + } |
| 147 | + |
| 148 | + protected function getParamDescription() |
| 149 | + { |
| 150 | + return array( |
| 151 | + 'namespace' => "Show {$this->description}s in this namespace(s) only" |
| 152 | + ); |
| 153 | + } |
| 154 | + |
135 | 155 | protected function getDescription() { |
136 | 156 | return "Returns all {$this->description}s from the given page(s)"; |
137 | 157 | } |
— | — | @@ -140,7 +160,9 @@ |
141 | 161 | "Get {$this->description}s from the [[Main Page]]:", |
142 | 162 | " api.php?action=query&prop={$this->getModuleName()}&titles=Main%20Page", |
143 | 163 | "Get information about the {$this->description} pages in the [[Main Page]]:", |
144 | | - " api.php?action=query&generator={$this->getModuleName()}&titles=Main%20Page&prop=info" |
| 164 | + " api.php?action=query&generator={$this->getModuleName()}&titles=Main%20Page&prop=info", |
| 165 | + "Get {$this->description}s from the Main Page in the User and Template namespaces:", |
| 166 | + " api.php?action=query&prop={$this->getModuleName()}&titles=Main%20Page&{$this->prefix}namespace=2|10" |
145 | 167 | ); |
146 | 168 | } |
147 | 169 | |