From: Roan Kattouw Date: Sat, 20 Jun 2009 08:10:30 +0000 (+0000) Subject: API: Return HTTP 503 status code on maxlag error, like index.php does X-Git-Tag: 1.31.0-rc.0~41279 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=a7f355adbb5e5bf0a451b7f2faaa480bd007b5ea;p=lhc%2Fweb%2Fwiklou.git API: Return HTTP 503 status code on maxlag error, like index.php does --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 58bd9f22a5..5ef87d15d4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -225,6 +225,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 18785) Add siprop=languages to meta=siteinfo * (bug 14200) Added user and excludeuser parameters to list=watchlist and list=recentchanges +* Return HTTP 503 status code on maxlag error, like index.php does === Languages updated in 1.16 === diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 218f4d2f2b..f39a2fcbb2 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -378,11 +378,10 @@ class ApiMain extends ApiBase { if ( $lag > $maxLag ) { header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) ); header( 'X-Database-Lag: ' . intval( $lag ) ); - // XXX: should we return a 503 HTTP error code like wfMaxlagError() does? if( $wgShowHostnames ) { - $this->dieUsage( "Waiting for $host: $lag seconds lagged", 'maxlag' ); + $this->dieUsage( "Waiting for $host: $lag seconds lagged", 'maxlag', 503 ); } else { - $this->dieUsage( "Waiting for a database server: $lag seconds lagged", 'maxlag' ); + $this->dieUsage( "Waiting for a database server: $lag seconds lagged", 'maxlag', 503 ); } return; }