summaryrefslogtreecommitdiffstats
path: root/wp-includes/functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-01-02 16:00:05 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-01-02 16:00:05 +0000
commit1503e05616c295e6f980134dc341fa1a66dc9672 (patch)
treeb0a7dc356affec0059670603f1cb990da7dbc026 /wp-includes/functions.php
parentc65d51fec1d641efd1ec8a44c046cd54d588fe3b (diff)
downloadwordpress-mu-1503e05616c295e6f980134dc341fa1a66dc9672.tar.gz
wordpress-mu-1503e05616c295e6f980134dc341fa1a66dc9672.tar.xz
wordpress-mu-1503e05616c295e6f980134dc341fa1a66dc9672.zip
Merge with WP 2.3.2
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1172 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/functions.php')
-rw-r--r--wp-includes/functions.php48
1 files changed, 40 insertions, 8 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index bd89231..a067a8a 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -204,10 +204,10 @@ function get_option($setting) {
if ( false === $value ) {
if ( defined('WP_INSTALLING') )
- $wpdb->hide_errors();
+ $show = $wpdb->hide_errors();
$row = $wpdb->get_row("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting' LIMIT 1");
if ( defined('WP_INSTALLING') )
- $wpdb->show_errors();
+ $wpdb->show_errors($show);
if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
$value = $row->option_value;
@@ -242,11 +242,11 @@ function form_option($option) {
function get_alloptions() {
global $wpdb, $wp_queries;
- $wpdb->hide_errors();
+ $show = $wpdb->hide_errors();
if ( !$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'") ) {
$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
}
- $wpdb->show_errors();
+ $wpdb->show_errors($show);
foreach ($options as $option) {
// "When trying to design a foolproof system,
@@ -269,10 +269,10 @@ function wp_load_alloptions() {
$alloptions = wp_cache_get('alloptions', 'options');
if ( !$alloptions ) {
- $wpdb->hide_errors();
+ $show = $wpdb->hide_errors();
if ( !$alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'") )
$alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
- $wpdb->show_errors();
+ $wpdb->show_errors($show);
$alloptions = array();
foreach ( (array) $alloptions_db as $o )
$alloptions[$o->option_name] = $o->option_value;
@@ -899,9 +899,9 @@ function do_robots() {
function is_blog_installed() {
global $wpdb;
- $wpdb->hide_errors();
+ $show = $wpdb->hide_errors();
$installed = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
- $wpdb->show_errors();
+ $wpdb->show_errors($show);
$install_status = !empty( $installed ) ? TRUE : FALSE;
return $install_status;
@@ -1426,4 +1426,36 @@ function wp_ob_end_flush_all()
while ( @ob_end_flush() );
}
+function dead_db() {
+ global $wpdb;
+
+ // Load custom DB error template, if present.
+ if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) {
+ require_once( ABSPATH . 'wp-content/db-error.php' );
+ die();
+ }
+
+ // If installing or in the admin, provide the verbose message.
+ if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )
+ wp_die($wpdb->error);
+
+ // Otherwise, be terse.
+ status_header( 500 );
+ nocache_headers();
+ header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
+<head>
+ <title>Database Error</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+ <h1>Error establishing a database connection</h1>
+</body>
+</html>
+<?php
+ die();
+}
+
?>