mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-12 09:24:59 +00:00
Merge "Add Linter categories to action=query&meta=siteinfo"
This commit is contained in:
commit
461e9edd05
|
@ -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": {
|
||||
|
|
|
@ -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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue