WordPress.org

Make WordPress Core

Ticket #15682: 15682.patch

File 15682.patch, 1.5 KB (added by zippykid, 4 years ago)

resubmitted with suggestions from comments.

  • wp-includes/wp-db.php

     
    496496        function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { 
    497497                register_shutdown_function( array( &$this, '__destruct' ) ); 
    498498 
    499                 if ( WP_DEBUG ) 
     499                if ( (WP_DEBUG ) || defined ('WP_SETUP_CONFIG') )  
    500500                        $this->show_errors(); 
    501501 
    502502                $this->init_charset(); 
     
    10331033                } 
    10341034 
    10351035                if ( !$this->dbh ) { 
    1036                         $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/" 
     1036                        // if we're setting up, the error message here should be a little more specific  
     1037                        if( defined ( 'WP_SETUP_CONFIG' ) ) { 
     1038                         
     1039                                $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"  
     1040<h1> We got the following error with your database credentials </h1>  
     1041<code> %s </code>  
     1042<p>  
     1043You may want to check your credentials once again?  
     1044</p>   
     1045"/*/WP_I18N_DB_CONN_ERROR*/, mysql_error()),  'db_connect_fail'); 
     1046                                die();  
     1047                        } else {         
     1048                                $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/" 
    10371049<h1>Error establishing a database connection</h1> 
    10381050<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p> 
    10391051<ul> 
     
    10461058 
    10471059                        //If show errors is disabled then we need to die anyway as we don't have a working DB connection 
    10481060                        die(); 
     1061                        }        
    10491062                } 
    10501063 
    10511064                $this->set_charset( $this->dbh );