Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -356,8 +356,8 @@ |
357 | 357 | |
358 | 358 | 'APIQuerySiteInfoGeneralInfo': use this hook to add extra information to |
359 | 359 | the sites general information. |
360 | | -$module: the current ApiQuerySiteInfo module |
361 | | -$resutls: array of results, add things here |
| 360 | +&$module: the current ApiQuerySiteInfo module |
| 361 | +&$results: array of results, add things here |
362 | 362 | |
363 | 363 | 'APIQueryUsersTokens': use this hook to add custom token to list=users. |
364 | 364 | Every token has an action, which will be used in the ustoken parameter |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -273,6 +273,8 @@ |
274 | 274 | list=users&usprop=groups |
275 | 275 | * Addition of APIQuerySiteInfoGeneralInfo hook to add extra information to |
276 | 276 | the general site info results |
| 277 | +* (bug 16288) API: consider making closure status of wikis more clear |
| 278 | + with meta=siteinfo |
277 | 279 | |
278 | 280 | === Languages updated in 1.18 === |
279 | 281 | |
Index: trunk/extensions/SiteMatrix/SiteMatrix.php |
— | — | @@ -73,3 +73,4 @@ |
74 | 74 | $wgAutoloadClasses['ApiQuerySiteMatrix'] = $dir . 'SiteMatrixApi.php'; |
75 | 75 | $wgAPIModules['sitematrix'] = 'ApiQuerySiteMatrix'; |
76 | 76 | |
| 77 | +$wgHooks['APIQuerySiteInfoGeneralInfo'][] = 'SiteMatrix::APIQuerySiteInfoGeneralInfo'; |
\ No newline at end of file |
Index: trunk/extensions/SiteMatrix/SiteMatrix_body.php |
— | — | @@ -149,7 +149,7 @@ |
150 | 150 | return !empty( $this->matrix[$major][$minor] ); |
151 | 151 | } |
152 | 152 | |
153 | | - /** |
| 153 | + /** |
154 | 154 | * @param string $minor Language |
155 | 155 | * @param string $major Site |
156 | 156 | * @return bool |
— | — | @@ -240,6 +240,45 @@ |
241 | 241 | private function extractFile( $filename ) { |
242 | 242 | return array_map( 'trim', file( $filename ) ); |
243 | 243 | } |
| 244 | + |
| 245 | + /** |
| 246 | + * Handler method for the APISiteInfoGeneralInfo hook |
| 247 | + * |
| 248 | + * @static |
| 249 | + * @param ApiQuerySiteinfo $module |
| 250 | + * @param array $results |
| 251 | + * @return void |
| 252 | + */ |
| 253 | + public static function APIQuerySiteInfoGeneralInfo( $module, $results ) { |
| 254 | + global $wgDBname, $wgLanguageCode; |
| 255 | + |
| 256 | + $matrix = new SiteMatrix(); |
| 257 | + |
| 258 | + $db = $wgDBname; |
| 259 | + $lang = $wgLanguageCode; |
| 260 | + if ( strpos( $wgDBname, $wgLanguageCode ) == 0 ) { |
| 261 | + $db = str_replace( $wgLanguageCode, '', $wgDBname ); |
| 262 | + $lang = ''; |
| 263 | + } |
| 264 | + |
| 265 | + if ( $matrix->isClosed( $lang, $db ) ) { |
| 266 | + $results['closed'] = ''; |
| 267 | + } |
| 268 | + |
| 269 | + if ( $matrix->isSpecial( $wgDBname ) ) { |
| 270 | + $results['special'] = ''; |
| 271 | + } |
| 272 | + |
| 273 | + if ( $matrix->isPrivate( $wgDBname ) ) { |
| 274 | + $results['private'] = ''; |
| 275 | + } |
| 276 | + |
| 277 | + if ( $matrix->isFishbowl( $wgDBname ) ) { |
| 278 | + $results['fishbowl'] = ''; |
| 279 | + } |
| 280 | + |
| 281 | + return true; |
| 282 | + } |
244 | 283 | } |
245 | 284 | |
246 | 285 | class SiteMatrixPage extends SpecialPage { |