mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
For unit tests that call wpmu_create_blog(), Blog factory, or installation code that attempts to clear transients: suppress database errors on setUp and restore on tearDown.
There are a few places in core that were preventing this from working by explicity setting `$wpdb->suppress_errors` to `false`. Instead, they should inherit the value that existed before errors were suppressed. This allows Multisite unit tests to run without explosive database errors, and allows `$wpdb->suppress_errors` to be overridden all the way down the chain. Fixes #26102. git-svn-id: https://develop.svn.wordpress.org/trunk@26252 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1129,10 +1129,10 @@ function install_blog( $blog_id, $blog_title = '' ) {
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||
|
||||
$wpdb->suppress_errors();
|
||||
$suppress = $wpdb->suppress_errors();
|
||||
if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) )
|
||||
die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
|
||||
$wpdb->suppress_errors( false );
|
||||
$wpdb->suppress_errors( $suppress );
|
||||
|
||||
$url = get_blogaddress_by_id( $blog_id );
|
||||
|
||||
@@ -1179,11 +1179,11 @@ function install_blog_defaults($blog_id, $user_id) {
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||
|
||||
$wpdb->suppress_errors();
|
||||
$suppress = $wpdb->suppress_errors();
|
||||
|
||||
wp_install_defaults($user_id);
|
||||
|
||||
$wpdb->suppress_errors( false );
|
||||
$wpdb->suppress_errors( $suppress );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user