From 370f4c4618fa7e35764691ea03c42912774989be Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sat, 5 Oct 2013 14:32:08 -0700 Subject: [PATCH] Add APIQuerySiteInfoStatisticsInfo hook Allows extensions to modify the output of action=query&meta=siteinfo&siprop=statstics Accompanies the SpecialStatsAddExtra hook for Special:Statistics Change-Id: I712748077a0ac2fb729bfe3b6616ac4981cb754e --- RELEASE-NOTES-1.22 | 2 ++ docs/hooks.txt | 4 ++++ includes/api/ApiQuerySiteinfo.php | 3 +++ 3 files changed, 9 insertions(+) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index a365da6159..a6b31b58bd 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -240,6 +240,8 @@ production. * ResourceLoader supports hashes as module cache invalidation trigger (instead of or in addition to timestamps). * Added $wgExtensionEntryPointListFiles for use in mergeMessageFileList.php. +* Added a hook, APIQuerySiteInfoStatisticsInfo, to allow extensions to modify + the output of the API query meta=siteinfo&siprop=statistics === Bug fixes in 1.22 === * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one diff --git a/docs/hooks.txt b/docs/hooks.txt index 2d1001ba52..53993de162 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -432,6 +432,10 @@ sites general information. $module: the current ApiQuerySiteInfo module &$results: array of results, add things here +'APIQuerySiteInfoStatisticsInfo': Use this hook to add extra information to the +sites statistics information. +&$results: array of results, add things here + 'APIQueryUsersTokens': Use this hook to add custom token to list=users. Every token has an action, which will be used in the ustoken parameter and in the output (actiontoken="..."), and a callback function which should return the diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 6aa311ece0..a7767062e8 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -421,6 +421,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { $data['activeusers'] = intval( SiteStats::activeUsers() ); $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) ); $data['jobs'] = intval( SiteStats::jobs() ); + + wfRunHooks( 'APIQuerySiteInfoStatisticsInfo', array( &$data ) ); + return $this->getResult()->addValue( 'query', $property, $data ); } -- 2.20.1