WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/21/2015 10:26:52 PM (3 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/install.php

    r35350 r36055  
    3232$phpmailer = new MockPHPMailer();
    3333
    34 $wpdb->query( 'SET storage_engine = INNODB' );
     34/*
     35 * default_storage_engine and storage_engine are the same option, but storage_engine
     36 * was deprecated in MySQL (and MariaDB) 5.5.3, and removed in 5.7.
     37 */
     38if ( version_compare( $wpdb->db_version(), '5.5.3', '>=' ) ) {
     39    $wpdb->query( 'SET default_storage_engine = InnoDB' );
     40} else {
     41    $wpdb->query( 'SET storage_engine = InnoDB' );
     42}
    3543$wpdb->select( DB_NAME, $wpdb->dbh );
    3644
Note: See TracChangeset for help on using the changeset viewer.