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": { "Hooks": {
"LoadExtensionSchemaUpdates": "MediaWiki\\Linter\\Hooks::onLoadExtensionSchemaUpdates", "LoadExtensionSchemaUpdates": "MediaWiki\\Linter\\Hooks::onLoadExtensionSchemaUpdates",
"EditFormInitialText": "MediaWiki\\Linter\\Hooks::onEditFormInitialText", "EditFormInitialText": "MediaWiki\\Linter\\Hooks::onEditFormInitialText",
"APIQuerySiteInfoGeneralInfo": "MediaWiki\\Linter\\Hooks::onAPIQuerySiteInfoGeneralInfo",
"WikiPageDeletionUpdates": "MediaWiki\\Linter\\Hooks::onWikiPageDeletionUpdates" "WikiPageDeletionUpdates": "MediaWiki\\Linter\\Hooks::onWikiPageDeletionUpdates"
}, },
"APIModules": { "APIModules": {

View file

@ -20,6 +20,7 @@
namespace MediaWiki\Linter; namespace MediaWiki\Linter;
use ApiQuerySiteInfo;
use Content; use Content;
use DatabaseUpdater; use DatabaseUpdater;
use EditPage; use EditPage;
@ -84,4 +85,20 @@ class Hooks {
$database->setForPage( [] ); $database->setForPage( [] );
}, __METHOD__ ); }, __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(),
];
}
} }