Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -131,6 +131,8 @@ |
132 | 132 | * (bug 26885) Allow show/hide of account blocks, temporary blocks and single IP |
133 | 133 | address blocks for list=blocks. |
134 | 134 | * (bug 30591) Add support to only return keys in ApiAllMessages. |
| 135 | +* The API now respects $wgShowHostnames and won't share the hostname in |
| 136 | + severedby if it's set to false |
135 | 137 | |
136 | 138 | === Languages updated in 1.19 === |
137 | 139 | |
Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -486,6 +486,8 @@ |
487 | 487 | * @return string |
488 | 488 | */ |
489 | 489 | protected function substituteResultWithError( $e ) { |
| 490 | + global $wgShowHostnames; |
| 491 | + |
490 | 492 | $result = $this->getResult(); |
491 | 493 | // Printer may not be initialized if the extractRequestParams() fails for the main module |
492 | 494 | if ( !isset ( $this->mPrinter ) ) { |
— | — | @@ -533,8 +535,12 @@ |
534 | 536 | if ( !is_null( $requestid ) ) { |
535 | 537 | $result->addValue( null, 'requestid', $requestid ); |
536 | 538 | } |
537 | | - // servedby is especially useful when debugging errors |
538 | | - $result->addValue( null, 'servedby', wfHostName() ); |
| 539 | + |
| 540 | + if ( $wgShowHostnames ) { |
| 541 | + // servedby is especially useful when debugging errors |
| 542 | + $result->addValue( null, 'servedby', wfHostName() ); |
| 543 | + } |
| 544 | + |
539 | 545 | $result->addValue( null, 'error', $errMessage ); |
540 | 546 | |
541 | 547 | return $errMessage['code']; |
— | — | @@ -545,16 +551,20 @@ |
546 | 552 | * @return array |
547 | 553 | */ |
548 | 554 | protected function setupExecuteAction() { |
| 555 | + global $wgShowHostnames; |
| 556 | + |
549 | 557 | // First add the id to the top element |
550 | 558 | $result = $this->getResult(); |
551 | 559 | $requestid = $this->getParameter( 'requestid' ); |
552 | 560 | if ( !is_null( $requestid ) ) { |
553 | 561 | $result->addValue( null, 'requestid', $requestid ); |
554 | 562 | } |
555 | | - // TODO: Isn't there a setting to disable sharing the server hostname? |
556 | | - $servedby = $this->getParameter( 'servedby' ); |
557 | | - if ( $servedby ) { |
558 | | - $result->addValue( null, 'servedby', wfHostName() ); |
| 563 | + |
| 564 | + if ( $wgShowHostnames ) { |
| 565 | + $servedby = $this->getParameter( 'servedby' ); |
| 566 | + if ( $servedby ) { |
| 567 | + $result->addValue( null, 'servedby', wfHostName() ); |
| 568 | + } |
559 | 569 | } |
560 | 570 | |
561 | 571 | $params = $this->extractRequestParams(); |