r23823 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23822‎ | r23823 | r23824 >
Date:04:53, 7 July 2007
Author:yurik
Status:old
Tags:
Comment:
API: (bug 10211) Added db server replication lag information in meta=siteinfo
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -57,6 +57,9 @@
5858 $filteriw = isset($params['filteriw']) ? $params['filteriw'] : false;
5959 $this->appendInterwikiMap($p, $filteriw);
6060 break;
 61+ case 'dbserverlag' :
 62+ $this->appendDbServerLagInfo($p, $params['showalldb']);
 63+ break;
6164 }
6265 }
6366 }
@@ -127,7 +130,32 @@
128131 $this->getResult()->setIndexedTagName($data, 'iw');
129132 $this->getResult()->addValue('query', $property, $data);
130133 }
 134+
 135+ protected function appendDbServerLagInfo($property, $includeAll) {
 136+ global $wgLoadBalancer;
131137
 138+ $data = array();
 139+
 140+ if ($includeAll) {
 141+ global $wgDBservers;
 142+ $lags = $wgLoadBalancer->getLagTimes();
 143+ foreach( $lags as $i => $lag ) {
 144+ $data[] = array (
 145+ 'host' => $wgDBservers[$i]['host'],
 146+ 'lag' => $lag);
 147+ }
 148+ } else {
 149+ list( $host, $lag ) = $wgLoadBalancer->getMaxLag();
 150+ $data[] = array (
 151+ 'host' => $host,
 152+ 'lag' => $lag);
 153+ }
 154+
 155+ $result = $this->getResult();
 156+ $result->setIndexedTagName($data, 'db');
 157+ $result->addValue('query', $property, $data);
 158+ }
 159+
132160 protected function getAllowedParams() {
133161 return array (
134162
@@ -137,7 +165,8 @@
138166 ApiBase :: PARAM_TYPE => array (
139167 'general',
140168 'namespaces',
141 - 'interwikimap'
 169+ 'interwikimap',
 170+ 'dbserverlag',
142171 )),
143172
144173 'filteriw' => array (
@@ -145,6 +174,8 @@
146175 'local',
147176 '!local',
148177 )),
 178+
 179+ 'showalldb' => false,
149180 );
150181 }
151182
@@ -154,9 +185,11 @@
155186 'Which sysinfo properties to get:',
156187 ' "general" - Overall system information',
157188 ' "namespaces" - List of registered namespaces (localized)',
158 - ' "interwikimap" - Return interwiki map (optionally filtered)'
 189+ ' "interwikimap" - Return interwiki map (optionally filtered)',
 190+ ' "dbserverlag" - Get highest database replication server lag',
159191 ),
160192 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
 193+ 'showalldb' => 'List all DB servers, not just the one lagging the most',
161194 );
162195 }
163196
Index: trunk/phase3/RELEASE-NOTES
@@ -305,6 +305,7 @@
306306 * backlinks, embeddedin and imageusage lists should use (bl|ei|iu)title parameter
307307 instead of titles. Titles for these lists is obsolete and might stop working soon.
308308 * Added prop=imageinfo - gets image properties and upload history
 309+* (bug 10211) Added db server replication lag information in meta=siteinfo
309310
310311 == Maintenance script changes since 1.10 ==
311312

Follow-up revisions

RevisionCommit summaryAuthorDate
r23912Merged revisions 23662-23909 via svnmerge from...david18:11, 9 July 2007

Status & tagging log