You are here

function apdqc_admin_convert_table_collations_to in Asynchronous Prefetch Database Query Cache 7

Convert cache table collations.

Parameters

bool $show_msg: Set to FALSE to not run drupal_set_message().

string $collation: Database collation; default is utf8_bin, can also use ascii_bin.

3 calls to apdqc_admin_convert_table_collations_to()
apdqc_admin_convert_table_collations_to_ascii_bin in ./apdqc.admin.inc
Convert cache table collations to ascii.
apdqc_admin_convert_table_collations_to_utf8_bin in ./apdqc.admin.inc
Convert cache table collations to utf8.
drush_apdqc in ./apdqc.drush.inc
Drush command to all all the apdqc functions.

File

./apdqc.admin.inc, line 562
Admin page callbacks for the apdqc module.

Code

function apdqc_admin_convert_table_collations_to($show_msg = TRUE, $collation = 'utf8_bin') {
  $before = apdqc_admin_change_table_collation(FALSE, $collation);

  // Run the command.
  apdqc_admin_change_table_collation(TRUE, $collation);

  // Let user know it worked.
  if ($show_msg !== FALSE) {
    $after = apdqc_admin_change_table_collation(FALSE, $collation);
    if (empty($before)) {
      drupal_set_message(t('APDQC: All cache tables collations were already @collation', array(
        '@collation' => $collation,
      )));
    }
    elseif (!empty($after)) {
      drupal_set_message(t('APDQC: Cache tables collations were not converted to @collation. You need to do this manually by using a tool like phpmyadmin.', array(
        '@collation' => $collation,
      )), 'error');
    }
    else {
      drupal_set_message(t('APDQC: All cache tables collations converted to @collation', array(
        '@collation' => $collation,
      )));
    }
  }
  variable_set('apdqc_table_collations', $collation);
}