X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiMain.php;h=86f7da8e64f27b7269cd72cab6ab2e933ac5960e;hb=81874262b1fc819d97f2437c770f38baea7f6762;hp=69124a16500e87710ba4257396be5e1732e548ea;hpb=21e108b5fff02d1c38f1d7b047ec974799a43a3d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 69124a1650..86f7da8e64 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -260,12 +260,12 @@ class ApiMain extends ApiBase { $this->printResult(true); } - $params = $this->extractRequestParams(); + global $wgRequest; if($this->mSquidMaxage == -1) { # Nobody called setCacheMaxAge(), use the (s)maxage parameters - $smaxage = $params['smaxage']; - $maxage = $params['maxage']; + $smaxage = $wgRequest->getVal('smaxage', 0); + $maxage = $wgRequest->getVal('maxage', 0); } else $smaxage = $maxage = $this->mSquidMaxage; @@ -314,14 +314,21 @@ class ApiMain extends ApiBase { ApiResult :: setContent($errMessage, $this->makeHelpMsg()); } else { + global $wgShowSQLErrors, $wgShowExceptionDetails; // // Something is seriously wrong // + if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) { + $info = "Database query error"; + } else { + $info = "Exception Caught: {$e->getMessage()}"; + } + $errMessage = array ( 'code' => 'internal_api_error_'. get_class($e), - 'info' => "Exception Caught: {$e->getMessage()}" + 'info' => $info, ); - ApiResult :: setContent($errMessage, "\n\n{$e->getTraceAsString()}\n\n"); + ApiResult :: setContent($errMessage, $wgShowExceptionDetails ? "\n\n{$e->getTraceAsString()}\n\n" : "" ); } $this->getResult()->reset();