function checkMaxLag($maxLag) { global $wgLoadBalancer; list($host, $lag) = $wgLoadBalancer->getMaxLag(); if ($lag > $maxLag) { wfMaxlagError($host, $lag, $maxLag); return false; } else { return true; } }
/** * Check if the maximum lag of database slaves is higher that $maxLag, and * if it's the case, output an error message * * @param $maxLag int: maximum lag allowed for the request, as supplied by * the client * @return bool true if the request can continue */ function checkMaxLag($maxLag) { list($host, $lag) = wfGetLB()->getMaxLag(); if ($lag > $maxLag) { wfMaxlagError($host, $lag, $maxLag); return false; } else { return true; } }