From: Brion Vibber Date: Sat, 12 Jun 2004 03:13:46 +0000 (+0000) Subject: On emergency abort check if headers have already been sent to avoid useless warnings... X-Git-Tag: 1.5.0alpha1~2893 X-Git-Url: http://git.cyclocoop.org/%22.%24redirect_annul.%22?a=commitdiff_plain;h=e2ee87c6e70ade0724a53b47a208918958e50866;p=lhc%2Fweb%2Fwiklou.git On emergency abort check if headers have already been sent to avoid useless warnings at that point. --- diff --git a/includes/Database.php b/includes/Database.php index 60647d5a10..03b640fa9e 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -462,7 +462,13 @@ class Database { function wfEmergencyAbort( &$conn ) { global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgSiteNotice, $wgOutputEncoding; - header( "Content-type: text/html; charset=$wgOutputEncoding" ); + if( !headers_sent() ) { + header( "HTTP/1.0 500 Internal Server Error" ); + header( "Content-type: text/html; charset=$wgOutputEncoding" ); + /* Don't cache error pages! They cause no end of trouble... */ + header( "Cache-control: none" ); + header( "Pragma: nocache" ); + } $msg = $wgSiteNotice; if($msg == "") $msg = wfMsgNoDB( "noconnect" ); $text = $msg; @@ -496,9 +502,6 @@ function wfEmergencyAbort( &$conn ) { } } - /* Don't cache error pages! They cause no end of trouble... */ - header( "Cache-control: none" ); - header( "Pragma: nocache" ); echo $text; wfAbruptExit(); }