mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-12 09:24:59 +00:00
Merge "Expose category totals in API response"
This commit is contained in:
commit
fddffa5ab3
|
@ -97,10 +97,15 @@ class Hooks {
|
|||
*/
|
||||
public static function onAPIQuerySiteInfoGeneralInfo( ApiQuerySiteInfo $api, array &$data ) {
|
||||
$catManager = new CategoryManager();
|
||||
$data['linter'] = [
|
||||
'errors' => $catManager->getErrors(),
|
||||
'warnings' => $catManager->getWarnings(),
|
||||
];
|
||||
$totals = ( new Database( 0 ) )->getTotals();
|
||||
$info = [];
|
||||
foreach ( $catManager->getErrors() as $error ) {
|
||||
$info['errors'][$error] = $totals[$error];
|
||||
}
|
||||
foreach ( $catManager->getWarnings() as $warning ) {
|
||||
$info['warnings'][$warning] = $totals[$warning];
|
||||
}
|
||||
$data['linter'] = $info;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue