return $article;
}
+ function checkMaxLag( $maxLag ) {
+ global $wgLoadBalancer;
+ list( $host, $lag ) = $wgLoadBalancer->getMaxLag();
+ if ( $lag > $maxLag ) {
+ header( 'HTTP/1.1 500 Internal server error' );
+ header( 'Content-Type: text/plain' );
+ echo "Waiting for $host: $lag seconds lagged\n";
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+
/**
* Checks some initial queries
* Note that $title here is *not* a Title object, but a string!
wfProfileIn( 'main-misc-setup' );
OutputPage::setEncodings(); # Not really used yet
+$maxLag = $wgRequest->getVal( 'maxlag' );
+if ( !is_null( $maxLag ) ) {
+ if ( !$mediaWiki->checkMaxLag( $maxLag ) ) {
+ exit;
+ }
+}
+
# Query string fields
$action = $wgRequest->getVal( 'action', 'view' );
$title = $wgRequest->getVal( 'title' );