MediaWiki:BackendInformation.js

function parseHttpHeaders(httpHeaders) { return httpHeaders.split("\n").map(function(x) {		return x.split(/: */, 2);	}).filter(function(x) {		return x[0];	}).reduce(function(ac, x) {		ac[x[0]] = x[1];		return ac;	}, {}); }

var req = new XMLHttpRequest; req.open('GET', document.location, false); req.send(null); var headers = parseHttpHeaders(req.getAllResponseHeaders);

function showBackendPerformance { var respTime = mw.config.get('wgBackendResponseTime'), backend = mw.config.get('wgPoweredByHHVM') ? 'HHVM' : 'PHP7', server = mw.config.get('wgHostname'), cp = headers['x-served-by'].replace(/.miraheze.org|^mw[0-9]+|\s|,/g, ''), dbname = mw.config.get('wgDBname'), caption = respTime.toString + 'ms ( ' + backend + ' via ' + dbname + '@' + server + ' / ' + cp + ')'; if (mw.config.get('skin') === 'cosmos') { $('').html(caption).appendTo('#p-tb ul'); } else { $('').html(caption).prependTo('#p-personal ul'); } } $(document).ready(showBackendPerformance);