Ticket #5495: wpdb-error.diff

File wpdb-error.diff, 2.1 KB (added by andy, 4 years ago)
  • wp-includes/wp-db.php

     
    115115<p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p> 
    116116<ul> 
    117117<li>Are you sure it exists?</li> 
     118<li>Does the user <code>".DB_USER."</code> have permission to use the <code>$db</code> database?</li> 
    118119<li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li> 
    119120</ul> 
    120121<p>If you don't know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>"); 
     
    462463         * @param string $message 
    463464         */ 
    464465        function bail($message) { // Just wraps errors in a nice header and footer 
    465                 if ( !$this->show_errors ) 
     466                if ( !$this->show_errors ) { 
     467                        if ( class_exists('WP_Error') ) 
     468                                $this->error = new WP_Error('500', $message); 
     469                        else 
     470                                $this->error = $message; 
    466471                        return false; 
     472                } 
    467473                wp_die($message); 
    468474        } 
     475 
    469476        /** 
    470477         * Checks wether of not the database version is high enough to support the features WordPress uses 
    471478         * @global $wp_version 
  • wp-admin/setup-config.php

     
    66 
    77require_once('../wp-includes/compat.php'); 
    88require_once('../wp-includes/functions.php'); 
     9require_once('../wp-includes/classes.php'); 
    910 
    1011if (!file_exists('../wp-config-sample.php')) 
    1112        wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 
     
    164165 
    165166        // We'll fail here if the values are no good. 
    166167        require_wp_db(); 
     168        if ( !empty($wpdb->error) ) 
     169                wp_die($wpdb->error->get_error_message()); 
     170 
    167171        $handle = fopen('../wp-config.php', 'w'); 
    168172 
    169173        foreach ($configFile as $line_num => $line) {