r69231 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69230‎ | r69231 | r69232 >
Date:10:37, 10 July 2010
Author:demon
Status:ok
Tags:
Comment:
(bug 24303) Expose hostname in API results. Show via servedby parameter, added unconditionally on errors
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -981,12 +981,20 @@
982982 }
983983 $this->parent->output->addWikiText( wfMsgNoTrans( 'config-welcome' ) );
984984 $status = $this->parent->doEnvironmentChecks();
985 - if ( $status ) {
 985+ if ( $status->isOk() ) {
986986 $this->parent->output->addWikiText( wfMsgNoTrans( 'config-copyright', wfMsg( 'config-authors' ) ) );
987987 $this->startForm();
988988 $this->endForm();
989989 }
990990 }
 991+
 992+ public function beginEnvCheck( $step ) {
 993+
 994+ }
 995+
 996+ public function endEnvCheck( $step, $status ) {
 997+
 998+ }
991999 }
9921000
9931001 class WebInstaller_DBConnect extends WebInstallerPage {
Index: trunk/phase3/includes/installer/Installer.php
@@ -298,15 +298,17 @@
299299 * Under the web subclass, it can already be assumed that PHP 5+ is in use
300300 * and that sessions are working.
301301 */
302 - function doEnvironmentChecks() {
 302+ function doEnvironmentChecks( $beginCB, $endCB ) {
303303 $this->showMessage( 'config-env-php', phpversion() );
304304
305305 $good = true;
306306 foreach ( $this->envChecks as $check ) {
 307+ call_user_func_array( $beginCB, array( $check ) );
307308 $status = $this->$check();
308309 if ( $status === false ) {
309310 $good = false;
310311 }
 312+ call_user_func_array( $endCB, array( $check, $status ) );
311313 }
312314 $this->setVar( '_Environment', $good );
313315 if ( $good ) {
Index: trunk/phase3/includes/api/ApiMain.php
@@ -385,6 +385,8 @@
386386 if ( !is_null( $requestid ) ) {
387387 $this->getResult()->addValue( null, 'requestid', $requestid );
388388 }
 389+ // servedby is especially useful when debugging errors
 390+ $this->getResult()->addValue( null, 'servedby', wfHostName() );
389391 $this->getResult()->addValue( null, 'error', $errMessage );
390392
391393 return $errMessage['code'];
@@ -399,6 +401,10 @@
400402 if ( !is_null( $requestid ) ) {
401403 $this->getResult()->addValue( null, 'requestid', $requestid );
402404 }
 405+ $servedby = $this->getParameter( 'servedby' );
 406+ if( !is_null( $servedby ) ) {
 407+ $this->getResult()->addValue( null, 'servedby', wfHostName() );
 408+ }
403409
404410 $params = $this->extractRequestParams();
405411
@@ -591,6 +597,7 @@
592598 ApiBase::PARAM_DFLT => 0
593599 ),
594600 'requestid' => null,
 601+ 'servedby' => false,
595602 );
596603 }
597604
@@ -606,6 +613,7 @@
607614 'smaxage' => 'Set the s-maxage header to this many seconds. Errors are never cached',
608615 'maxage' => 'Set the max-age header to this many seconds. Errors are never cached',
609616 'requestid' => 'Request ID to distinguish requests. This will just be output back to you',
 617+ 'servedby' => 'Include the hostname that served the request in the results. Unconditionally shown on error',
610618 );
611619 }
612620
Index: trunk/phase3/RELEASE-NOTES
@@ -264,6 +264,8 @@
265265 * (bug 24136) unknownerror when adding new section without summary, but forceditsummary
266266 * (bug 16886) Sister projects box moves down the extract of the first result in IE 7.
267267 * (bug 22339) Added srwhat=nearmatch to list=search to get a "go" result
 268+* (bug 24303) Added new &servedby parameter to all actions which adds the hostname
 269+ that served the request to the result. It is also added unconditionally on error
268270
269271 === Languages updated in 1.17 ===
270272

Follow-up revisions

RevisionCommit summaryAuthorDate
r69232Partial revert r69231, unrelated and unfinished installer changesdemon10:39, 10 July 2010
r69234Follow-up r69231: servedby is a boolean so will always be non-null.btongminh10:47, 10 July 2010

Status & tagging log