aboutsummaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorJohn Du Hart <johnduhart@users.mediawiki.org>2011-10-26 19:39:56 +0000
committerJohn Du Hart <johnduhart@users.mediawiki.org>2011-10-26 19:39:56 +0000
commitd021e1e965c456b5d75cfaa3c74e94196c319db8 (patch)
tree283b560c92c7e557f1b357241e6858dd71370bb0 /includes
parenta550d7b2cb5602412f3da78eb7002723fa940eba (diff)
downloadmediawikicore-d021e1e965c456b5d75cfaa3c74e94196c319db8.tar.gz
mediawikicore-d021e1e965c456b5d75cfaa3c74e94196c319db8.zip
Followup r100847, ApiMain now respects $wgShowHostnames
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/100858
Diffstat (limited to 'includes')
-rw-r--r--includes/api/ApiMain.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 11c4b22586c4..549aad676916 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -486,6 +486,8 @@ class ApiMain extends ApiBase {
* @return string
*/
protected function substituteResultWithError( $e ) {
+ global $wgShowHostnames;
+
$result = $this->getResult();
// Printer may not be initialized if the extractRequestParams() fails for the main module
if ( !isset ( $this->mPrinter ) ) {
@@ -533,8 +535,12 @@ class ApiMain extends ApiBase {
if ( !is_null( $requestid ) ) {
$result->addValue( null, 'requestid', $requestid );
}
- // servedby is especially useful when debugging errors
- $result->addValue( null, 'servedby', wfHostName() );
+
+ if ( $wgShowHostnames ) {
+ // servedby is especially useful when debugging errors
+ $result->addValue( null, 'servedby', wfHostName() );
+ }
+
$result->addValue( null, 'error', $errMessage );
return $errMessage['code'];
@@ -545,16 +551,20 @@ class ApiMain extends ApiBase {
* @return array
*/
protected function setupExecuteAction() {
+ global $wgShowHostnames;
+
// First add the id to the top element
$result = $this->getResult();
$requestid = $this->getParameter( 'requestid' );
if ( !is_null( $requestid ) ) {
$result->addValue( null, 'requestid', $requestid );
}
- // TODO: Isn't there a setting to disable sharing the server hostname?
- $servedby = $this->getParameter( 'servedby' );
- if ( $servedby ) {
- $result->addValue( null, 'servedby', wfHostName() );
+
+ if ( $wgShowHostnames ) {
+ $servedby = $this->getParameter( 'servedby' );
+ if ( $servedby ) {
+ $result->addValue( null, 'servedby', wfHostName() );
+ }
}
$params = $this->extractRequestParams();