Changeset 6447

Show
Ignore:
Timestamp:
12/21/07 02:53:57 (7 months ago)
Author:
ryan
Message:

Custom DB error page. fixes #5500 for 2.4

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/functions.php

    r6402 r6447  
    15301530} 
    15311531 
     1532function dead_db() { 
     1533    global $wpdb; 
     1534 
     1535    // Load custom DB error template, if present. 
     1536    if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) { 
     1537        require_once( ABSPATH . 'wp-content/db-error.php' ); 
     1538        die(); 
     1539    } 
     1540 
     1541    // If installing or in the admin, provide the verbose message. 
     1542    if ( defined('WP_INSTALLING') || defined('WP_ADMIN') ) 
     1543        wp_die($wpdb->error); 
     1544 
     1545    // Otherwise, be terse. 
     1546    status_header( 500 ); 
     1547    nocache_headers(); 
     1548    header( 'Content-Type: text/html; charset=utf-8' ); 
     1549?> 
     1550<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     1551<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>> 
     1552<head> 
     1553    <title>Database Error</title> 
     1554    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     1555</head> 
     1556<body> 
     1557    <h1>Error establishing a database connection</h1> 
     1558</body> 
     1559</html> 
     1560<?php 
     1561    die(); 
     1562} 
    15321563 
    15331564/** 
     
    15741605        return $url; 
    15751606} 
     1607 
    15761608?> 
  • trunk/wp-settings.php

    r6437 r6447  
    197197 
    198198require_wp_db(); 
     199 
     200if ( !empty($wpdb->error) ) 
     201    dead_db(); 
     202 
    199203$prefix = $wpdb->set_prefix($table_prefix); 
    200204