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