* have been accumulated, and replace it with an error message and a help screen.
*/
protected function executeActionWithErrorHandling() {
- $params = $this->extractRequestParams();
- if( isset( $params['maxlag'] ) ) {
- // Check for maxlag
- global $wgLoadBalancer;
- $maxLag = $params['maxlag'];
- list( $host, $lag ) = $wgLoadBalancer->getMaxLag();
- if ( $lag > $maxLag ) {
- wfMaxlagError( $host, $lag, $maxLag );
- return;
- }
- }
// In case an error occurs during data output,
// clear the output buffer and print just the error information
// Instantiate the module requested by the user
$module = new $this->mModules[$this->mAction] ($this, $this->mAction);
+
+ if( $module->shouldCheckMaxlag() && isset( $params['maxlag'] ) ) {
+ // Check for maxlag
+ global $wgLoadBalancer, $wgShowHostnames;
+ $maxLag = $params['maxlag'];
+ list( $host, $lag ) = $wgLoadBalancer->getMaxLag();
+ if ( $lag > $maxLag ) {
+ if( $wgShowHostnames ) {
+ ApiBase :: dieUsage( "Waiting for $host: $lag seconds lagged", 'maxlag' );
+ } else {
+ ApiBase :: dieUsage( "Waiting for a database server: $lag seconds lagged", 'maxlag' );
+ }
+ return;
+ }
+ }
if (!$this->mInternalMode) {
$psModule = new ApiPageSet($this);
return $psModule->makeHelpMsgParameters() . parent :: makeHelpMsgParameters();
}
+
+ // @todo should work correctly
+ public function shouldCheckMaxlag() {
+ return true;
+ }
protected function getParamDescription() {
return array (