Merge "Introduce ApiMaxLagInfo hook"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 5 Jun 2018 18:01:49 +0000 (18:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 5 Jun 2018 18:01:49 +0000 (18:01 +0000)
RELEASE-NOTES-1.32
docs/hooks.txt
includes/api/ApiMain.php

index 3d22f36..702b289 100644 (file)
@@ -36,6 +36,7 @@ production.
   temporary user groups.
 * (T152462) A cookie can now be set when an IP user is blocked to track that user if
   they move to a new IP address. This is disabled by default.
+* (T194950) Added 'ApiMaxLagInfo' hook.
 
 === External library changes in 1.32 ===
 * …
@@ -72,6 +73,7 @@ production.
 * Added 'ApiParseMakeOutputPage' hook.
 * Parameter names may no longer contain '{' or '}', as these are now used for
   templated parameters.
+* (T194950) Added 'ApiMaxLagInfo' hook.
 
 === Languages updated in 1.32 ===
 MediaWiki supports over 350 languages. Many localisations are updated regularly.
index 349cd4b..8c84509 100644 (file)
@@ -2265,6 +2265,18 @@ $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a
   sysop to patrol the edit.
 $auto: true if the edit is being marked as patrolled automatically
 
+'ApiMaxLagInfo': When lag information is being requested via API. Use this to
+override lag information. Generally a hook function should only replace
+$lagInfo if the new $lagInfo['lag'] is greater than the current $lagInfo['lag'].
+&$lagInfo: Maximum lag information array. Fields in the array are:
+  'lag' is the number of seconds of lag.
+  'host' is the host name on which the lag exists.
+  'type' is an indication of the type of lag,
+    e.g. "db" for database replication lag or "jobqueue" for job queue size
+    converted to pseudo-seconds.
+  It is possible to add more fields and they will be returned to the user in
+  the API response.
+
 'MediaWikiPerformAction': Override MediaWiki::performAction(). Use this to do
 something completely different, after the basic globals have been set up, but
 before ordinary actions take place.
index 914d8e9..c0c4895 100644 (file)
@@ -1258,6 +1258,8 @@ class ApiMain extends ApiBase {
                        }
                }
 
+               Hooks::runWithoutAbort( 'ApiMaxLagInfo', [ &$lagInfo ] );
+
                return $lagInfo;
        }