Ticket #5932: 5932.9.diff
File 5932.9.diff, 2.2 KB (added by , 11 years ago) |
---|
-
src/wp-includes/wp-db.php
966 966 } 967 967 if ( ! $success ) { 968 968 $this->ready = false; 969 wp_load_translations_early(); 970 $this->bail( sprintf( __( '<h1>Can’t select database</h1> 969 if ( ! did_action( 'wp_head' ) ) { 970 wp_load_translations_early(); 971 $this->bail( sprintf( __( '<h1>Can’t select database</h1> 971 972 <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>%1$s</code> database.</p> 972 973 <ul> 973 974 <li>Are you sure it exists?</li> … … 975 976 <li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li> 976 977 </ul> 977 978 <p>If you don\'t know how to set up 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>' ), htmlspecialchars( $db, ENT_QUOTES ), htmlspecialchars( $this->dbuser, ENT_QUOTES ) ), 'db_select_fail' ); 979 } 978 980 return; 979 981 } 980 982 } … … 1371 1373 /** 1372 1374 * Check that the connection to the database is still up. If not, try to reconnect. 1373 1375 * 1374 * If this function is unable to reconnect, it will forcibly die. 1376 * If this function is unable to reconnect, it will forcibly die before wp_head has been 1377 * triggered, or return false after wp_head has been triggered. 1375 1378 * 1376 1379 * @since 3.9.0 1377 1380 * … … 1414 1417 sleep( 1 ); 1415 1418 } 1416 1419 1420 // If wp_head has already happened, wp_die()/dead_db() won't work properly, 1421 // so let's just return and hope for the best. 1422 if ( did_action( 'wp_head' ) ) { 1423 return false; 1424 } 1425 1417 1426 // We weren't able to reconnect, so we better bail. 1418 1427 $this->bail( sprintf( ( " 1419 1428 <h1>Error reconnecting to the database</h1> … … 1479 1488 if ( empty( $this->dbh ) || 2006 == $mysql_errno ) { 1480 1489 if ( $this->check_connection() ) { 1481 1490 $this->_do_query( $query ); 1491 } else { 1492 $this->insert_id = 0; 1493 return false; 1482 1494 } 1483 1495 } 1484 1496