Index: trunk/extensions/Gadgets/ApiQueryGadgets.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | class ApiQueryGadgets extends ApiQueryBase { |
24 | 24 | private $props, |
25 | 25 | $categories, |
26 | | - $neededNames, |
| 26 | + $neededIds, |
27 | 27 | $listAllowed, |
28 | 28 | $listEnabled; |
29 | 29 | |
— | — | @@ -36,8 +36,8 @@ |
37 | 37 | $this->categories = isset( $params['categories'] ) |
38 | 38 | ? array_flip( $params['categories'] ) |
39 | 39 | : false; |
40 | | - $this->neededNames = isset( $params['names'] ) |
41 | | - ? array_flip( $params['names'] ) |
| 40 | + $this->neededIds = isset( $params['ids'] ) |
| 41 | + ? array_flip( $params['ids'] ) |
42 | 42 | : false; |
43 | 43 | $this->listAllowed = isset( $params['allowedonly'] ) && $params['allowedonly']; |
44 | 44 | $this->listEnabled = isset( $params['enabledonly'] ) && $params['enabledonly']; |
— | — | @@ -77,8 +77,8 @@ |
78 | 78 | |
79 | 79 | foreach ( $gadgets as $g ) { |
80 | 80 | $row = array(); |
81 | | - if ( isset( $this->props['name'] ) ) { |
82 | | - $row['name'] = $g->getName(); |
| 81 | + if ( isset( $this->props['id'] ) ) { |
| 82 | + $row['id'] = $g->getName(); |
83 | 83 | } |
84 | 84 | if ( isset( $this->props['metadata'] ) ) { |
85 | 85 | $row['metadata'] = $this->fakeMetadata( $g ); |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | private function isNeeded( Gadget $gadget ) { |
103 | 103 | global $wgUser; |
104 | 104 | |
105 | | - return ( $this->neededNames === false || isset( $this->neededNames[$gadget->getName()] ) ) |
| 105 | + return ( $this->neededIds === false || isset( $this->neededIds[$gadget->getName()] ) ) |
106 | 106 | && ( !$this->listAllowed || $gadget->isAllowed( $wgUser ) ) |
107 | 107 | && ( !$this->listEnabled || $gadget->isEnabled( $wgUser ) ); |
108 | 108 | } |
— | — | @@ -151,10 +151,10 @@ |
152 | 152 | public function getAllowedParams() { |
153 | 153 | return array( |
154 | 154 | 'prop' => array( |
155 | | - ApiBase::PARAM_DFLT => 'name|metadata', |
| 155 | + ApiBase::PARAM_DFLT => 'id|metadata', |
156 | 156 | ApiBase::PARAM_ISMULTI => true, |
157 | 157 | ApiBase::PARAM_TYPE => array( |
158 | | - 'name', |
| 158 | + 'id', |
159 | 159 | 'metadata', |
160 | 160 | 'desc', |
161 | 161 | ), |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | ApiBase::PARAM_ISMULTI => true, |
166 | 166 | ApiBase::PARAM_TYPE => 'string', |
167 | 167 | ), |
168 | | - 'names' => array( |
| 168 | + 'ids' => array( |
169 | 169 | ApiBase::PARAM_TYPE => 'string', |
170 | 170 | ApiBase::PARAM_ISMULTI => true, |
171 | 171 | ), |
— | — | @@ -181,12 +181,12 @@ |
182 | 182 | return array( |
183 | 183 | 'prop' => array( |
184 | 184 | 'What gadget information to get:', |
185 | | - ' name - Internal gadget name', |
| 185 | + ' id - Internal gadget ID', |
186 | 186 | ' metadata - The gadget metadata', |
187 | 187 | ' desc - Gadget description transformed into HTML (can be slow, use only if really needed)', |
188 | 188 | ), |
189 | 189 | 'categories' => 'Gadgets from what categories to retrieve', |
190 | | - 'names' => 'Name(s) of gadgets to retrieve', |
| 190 | + 'ids' => 'ID(s) of gadgets to retrieve', |
191 | 191 | 'allowedonly' => 'List only gadgets allowed to current user', |
192 | 192 | 'enabledonly' => 'List only gadgets enabled by current user', |
193 | 193 | ); |
— | — | @@ -197,13 +197,13 @@ |
198 | 198 | $allProps = implode( '|', $params['prop'][ApiBase::PARAM_TYPE] ); |
199 | 199 | return array( |
200 | 200 | 'Get a list of gadgets along with their descriptions:', |
201 | | - ' api.php?action=query&list=gadgets&gaprop=name|desc', |
| 201 | + ' api.php?action=query&list=gadgets&gaprop=id|desc', |
202 | 202 | 'Get a list of gadgets with all possble properties:', |
203 | 203 | " api.php?action=query&list=gadgets&gaprop=$allProps", |
204 | 204 | 'Get a list of gadgets belonging to caregory "foo":', |
205 | 205 | ' api.php?action=query&list=gadgets&gacategories=foo', |
206 | | - 'Get information about gadgets named "foo" and "bar":', |
207 | | - ' api.php?action=query&list=gadgets&ganames=foo|bar&gaprop=name|desc|metadata', |
| 206 | + 'Get information about gadgets "foo" and "bar":', |
| 207 | + ' api.php?action=query&list=gadgets&gaids=foo|bar&gaprop=id|desc|metadata', |
208 | 208 | 'Get a list of gadgets enabled by current user:', |
209 | 209 | ' api.php?action=query&list=gadgets&gaenabledonly', |
210 | 210 | ); |