WordPress.org

Make WordPress Core

Changeset 6448


Ignore:
Timestamp:
12/21/2007 02:57:21 AM (13 years ago)
Author:
ryan
Message:

Custom DB error page. fixes #5500 for 2.3

Location:
branches/2.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/wp-includes/functions.php

    r6443 r6448  
    14201420}
    14211421
     1422function dead_db() {
     1423    global $wpdb;
     1424
     1425    // Load custom DB error template, if present.
     1426    if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) {
     1427        require_once( ABSPATH . 'wp-content/db-error.php' );
     1428        die();
     1429    }
     1430
     1431    // If installing or in the admin, provide the verbose message.
     1432    if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )
     1433        wp_die($wpdb->error);
     1434
     1435    // Otherwise, be terse.
     1436    status_header( 500 );
     1437    nocache_headers();
     1438    header( 'Content-Type: text/html; charset=utf-8' );
    14221439?>
     1440<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     1441<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
     1442<head>
     1443    <title>Database Error</title>
     1444    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     1445</head>
     1446<body>
     1447    <h1>Error establishing a database connection</h1>
     1448</body>
     1449</html>
     1450<?php
     1451    die();
     1452}
     1453
     1454?>
  • branches/2.3/wp-settings.php

    r6139 r6448  
    122122else
    123123    require_once (ABSPATH . WPINC . '/wp-db.php');
     124
     125if ( !empty($wpdb->error) )
     126    dead_db();
    124127
    125128// $table_prefix is deprecated as of 2.1
Note: See TracChangeset for help on using the changeset viewer.