From: Chad Horohoe Date: Sat, 10 Jul 2010 10:37:39 +0000 (+0000) Subject: (bug 24303) Expose hostname in API results. Show via servedby parameter, added uncond... X-Git-Tag: 1.31.0-rc.0~36179 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=18d8635d000c09ffe31cc39ebab203824f1f4d5d;p=lhc%2Fweb%2Fwiklou.git (bug 24303) Expose hostname in API results. Show via servedby parameter, added unconditionally on errors --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4973b34b8a..4ead788389 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -264,6 +264,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 24136) unknownerror when adding new section without summary, but forceditsummary * (bug 16886) Sister projects box moves down the extract of the first result in IE 7. * (bug 22339) Added srwhat=nearmatch to list=search to get a "go" result +* (bug 24303) Added new &servedby parameter to all actions which adds the hostname + that served the request to the result. It is also added unconditionally on error === Languages updated in 1.17 === diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 260be900eb..bf6bc891ca 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -385,6 +385,8 @@ class ApiMain extends ApiBase { if ( !is_null( $requestid ) ) { $this->getResult()->addValue( null, 'requestid', $requestid ); } + // servedby is especially useful when debugging errors + $this->getResult()->addValue( null, 'servedby', wfHostName() ); $this->getResult()->addValue( null, 'error', $errMessage ); return $errMessage['code']; @@ -399,6 +401,10 @@ class ApiMain extends ApiBase { if ( !is_null( $requestid ) ) { $this->getResult()->addValue( null, 'requestid', $requestid ); } + $servedby = $this->getParameter( 'servedby' ); + if( !is_null( $servedby ) ) { + $this->getResult()->addValue( null, 'servedby', wfHostName() ); + } $params = $this->extractRequestParams(); @@ -591,6 +597,7 @@ class ApiMain extends ApiBase { ApiBase::PARAM_DFLT => 0 ), 'requestid' => null, + 'servedby' => false, ); } @@ -606,6 +613,7 @@ class ApiMain extends ApiBase { 'smaxage' => 'Set the s-maxage header to this many seconds. Errors are never cached', 'maxage' => 'Set the max-age header to this many seconds. Errors are never cached', 'requestid' => 'Request ID to distinguish requests. This will just be output back to you', + 'servedby' => 'Include the hostname that served the request in the results. Unconditionally shown on error', ); } diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 510b8c621e..4cfe591870 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -298,15 +298,17 @@ abstract class Installer { * Under the web subclass, it can already be assumed that PHP 5+ is in use * and that sessions are working. */ - function doEnvironmentChecks() { + function doEnvironmentChecks( $beginCB, $endCB ) { $this->showMessage( 'config-env-php', phpversion() ); $good = true; foreach ( $this->envChecks as $check ) { + call_user_func_array( $beginCB, array( $check ) ); $status = $this->$check(); if ( $status === false ) { $good = false; } + call_user_func_array( $endCB, array( $check, $status ) ); } $this->setVar( '_Environment', $good ); if ( $good ) { diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 96d4842736..d54602f5ae 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -981,12 +981,20 @@ class WebInstaller_Welcome extends WebInstallerPage { } $this->parent->output->addWikiText( wfMsgNoTrans( 'config-welcome' ) ); $status = $this->parent->doEnvironmentChecks(); - if ( $status ) { + if ( $status->isOk() ) { $this->parent->output->addWikiText( wfMsgNoTrans( 'config-copyright', wfMsg( 'config-authors' ) ) ); $this->startForm(); $this->endForm(); } } + + public function beginEnvCheck( $step ) { + + } + + public function endEnvCheck( $step, $status ) { + + } } class WebInstaller_DBConnect extends WebInstallerPage {