Tests: Use the `default_storage_engine` MySQL option on newer MySQL versions.

In MySQL 5.5.3, `storage_engine` was deprecated in favour of `default_storage_engine`, and subsequently removed in MySQL 5.7. To avoid errors when running tests on MySQL 5.7, we need to switch between the options based on MySQL version.

Props skithund, jeremyfelt.

Fixes #34692.



git-svn-id: https://develop.svn.wordpress.org/trunk@36055 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2015-12-21 22:26:52 +00:00
parent 688916d200
commit d303221d08
1 changed files with 9 additions and 1 deletions

View File

@ -31,7 +31,15 @@ global $phpmailer;
require_once( dirname( __FILE__ ) . '/mock-mailer.php' );
$phpmailer = new MockPHPMailer();
$wpdb->query( 'SET storage_engine = INNODB' );
/*
* default_storage_engine and storage_engine are the same option, but storage_engine
* was deprecated in MySQL (and MariaDB) 5.5.3, and removed in 5.7.
*/
if ( version_compare( $wpdb->db_version(), '5.5.3', '>=' ) ) {
$wpdb->query( 'SET default_storage_engine = InnoDB' );
} else {
$wpdb->query( 'SET storage_engine = InnoDB' );
}
$wpdb->select( DB_NAME, $wpdb->dbh );
echo "Installing..." . PHP_EOL;