Merge "Expose category totals in API response"

This commit is contained in:
jenkins-bot 2017-03-20 23:16:36 +00:00 committed by Gerrit Code Review
commit fddffa5ab3

View file

@ -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;
}
/**