Ticket #2409: 500_error_when_database_fubar.diff
File 500_error_when_database_fubar.diff, 1.8 KB (added by , 19 years ago) |
---|
-
wp-includes/wp-db.php
305 305 function bail($message) { // Just wraps errors in a nice header and footer 306 306 if ( !$this->show_errors ) 307 307 return false; 308 status_header( 500 ); 308 309 header( 'Content-Type: text/html; charset=utf-8'); 309 310 echo <<<HEAD 310 311 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> … … 360 361 } 361 362 362 363 $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 363 ?> 364 No newline at end of file 364 ?> -
wp-includes/functions.php
2183 2183 $wp->main($query_vars); 2184 2184 } 2185 2185 2186 function status_header( $header ) { 2187 if ( 200 == $header ) 2188 $text = 'OK'; 2189 elseif ( 301 == $header ) 2190 $text = 'Moved Permanently'; 2191 elseif ( 302 == $header ) 2192 $text = 'Moved Temporarily'; 2193 elseif ( 304 == $header ) 2194 $text = 'Not Modified'; 2195 elseif ( 404 == $header ) 2196 $text = 'Not Found'; 2197 elseif ( 410 == $header ) 2198 $text = 'Gone'; 2199 2186 function status_header( $header, $text='' ) { 2187 if ( '' == $text) { 2188 if ( 200 == $header ) 2189 $text = 'OK'; 2190 elseif ( 301 == $header ) 2191 $text = 'Moved Permanently'; 2192 elseif ( 302 == $header ) 2193 $text = 'Moved Temporarily'; 2194 elseif ( 304 == $header ) 2195 $text = 'Not Modified'; 2196 elseif ( 404 == $header ) 2197 $text = 'Not Found'; 2198 elseif ( 410 == $header ) 2199 $text = 'Gone'; 2200 elseif ( 500 == $header ) 2201 $text = 'Database Not Available'; 2202 } 2200 2203 @header("HTTP/1.1 $header $text"); 2201 2204 @header("Status: $header $text"); 2202 2205 }