1 backdrop_web_test_case_cache.php protected BackdropWebTestCaseCache::alterToMyISAM()

Alter tables to MyISAM engine to speed up tests.

MyISAM is faster to delete and copy tables. It gives small adventage when /var/lib/mysql on SHM (memory) device, but much bigger when tests run on regular device.

File

core/modules/simpletest/backdrop_web_test_case_cache.php, line 169

Class

BackdropWebTestCaseCache
Class for setting up a full installation profile for caching purposes.

Code

protected function alterToMyISAM() {
  if (Database::getConnection()->driver() != 'mysql') {
    return;
  }
  $skip_alter = array(
    'taxonomy_term_data',
    'node',
    'node_access',
    'node_revision',
    'node_comment_statistics',
  );
  $tables = db_find_tables($this->databasePrefix . '%');
  foreach ($tables as $table) {
    $original_table_name = substr($table, strlen($this->databasePrefix));
    if (!in_array($original_table_name, $skip_alter)) {
      db_query('ALTER TABLE ' . $table . ' ENGINE=MyISAM');
    }
  }
}