From e2ee87c6e70ade0724a53b47a208918958e50866 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 12 Jun 2004 03:13:46 +0000 Subject: [PATCH] On emergency abort check if headers have already been sent to avoid useless warnings at that point. --- includes/Database.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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(); } -- 2.20.1