On emergency abort check if headers have already been sent to avoid useless warnings...
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 12 Jun 2004 03:13:46 +0000 (03:13 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 12 Jun 2004 03:13:46 +0000 (03:13 +0000)
includes/Database.php

index 60647d5..03b640f 100644 (file)
@@ -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();
 }