Add APIQuerySiteInfoStatisticsInfo hook
authorKunal Mehta <legoktm@gmail.com>
Sat, 5 Oct 2013 21:32:08 +0000 (14:32 -0700)
committerKunal Mehta <legoktm@gmail.com>
Sat, 12 Oct 2013 02:12:21 +0000 (19:12 -0700)
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
docs/hooks.txt
includes/api/ApiQuerySiteinfo.php

index a365da6..a6b31b5 100644 (file)
@@ -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
index 2d1001b..53993de 100644 (file)
@@ -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
index 6aa311e..a776706 100644 (file)
@@ -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 );
        }