Ticket #5500: dead-db.diff

File dead-db.diff, 1.7 kB (added by ryan, 7 months ago)
  • wp-includes/functions.php

    old new  
    15291529                require_once( ABSPATH . WPINC . '/wp-db.php' ); 
    15301530} 
    15311531 
     1532function dead_db() { 
     1533        global $wpdb; 
    15321534 
     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} 
     1563 
    15331564/** 
    15341565 * Converts input to an absolute integer 
    15351566 * @param mixed $maybeint data you wish to have convered to an absolute integer 
     
    15731604        else 
    15741605                return $url; 
    15751606} 
     1607 
    15761608?> 
  • wp-settings.php

    old new  
    196196require (ABSPATH . WPINC . '/classes.php'); 
    197197 
    198198require_wp_db(); 
     199 
     200if ( !empty($wpdb->error) ) 
     201        dead_db(); 
     202 
    199203$prefix = $wpdb->set_prefix($table_prefix); 
    200204 
    201205if ( is_wp_error($prefix) )