Merge "Add Linter categories to action=query&meta=siteinfo"

This commit is contained in:
jenkins-bot 2017-01-24 05:31:15 +00:00 committed by Gerrit Code Review
commit 461e9edd05
2 changed files with 18 additions and 0 deletions

View file

@ -27,6 +27,7 @@
"Hooks": {
"LoadExtensionSchemaUpdates": "MediaWiki\\Linter\\Hooks::onLoadExtensionSchemaUpdates",
"EditFormInitialText": "MediaWiki\\Linter\\Hooks::onEditFormInitialText",
"APIQuerySiteInfoGeneralInfo": "MediaWiki\\Linter\\Hooks::onAPIQuerySiteInfoGeneralInfo",
"WikiPageDeletionUpdates": "MediaWiki\\Linter\\Hooks::onWikiPageDeletionUpdates"
},
"APIModules": {

View file

@ -20,6 +20,7 @@
namespace MediaWiki\Linter;
use ApiQuerySiteInfo;
use Content;
use DatabaseUpdater;
use EditPage;
@ -84,4 +85,20 @@ class Hooks {
$database->setForPage( [] );
}, __METHOD__ );
}
/**
* Hook: APIQuerySiteInfoGeneralInfo
*
* Expose categories via action=query&meta=siteinfo
*
* @param ApiQuerySiteInfo $api
* @param array &$data
*/
public static function onAPIQuerySiteInfoGeneralInfo( ApiQuerySiteInfo $api, array &$data ) {
$catManager = new CategoryManager();
$data['linter'] = [
'errors' => $catManager->getErrors(),
'warnings' => $catManager->getWarnings(),
];
}
}