You are here

function drush_apdqc in Asynchronous Prefetch Database Query Cache 7

Drush command to all all the apdqc functions.

1 string reference to 'drush_apdqc'
apdqc_drush_command in ./apdqc.drush.inc
Implements hook_drush_command().

File

./apdqc.drush.inc, line 40
Drush integration for APDQC module.

Code

function drush_apdqc($collation = 'ascii_bin') {
  $maintenance_mode = variable_get('maintenance_mode', 0);

  // Take site offline.
  if (empty($maintenance_mode)) {
    variable_set('maintenance_mode', TRUE);
  }

  // Ensure we have the admin form functions.
  module_load_include('inc', 'apdqc', 'apdqc.admin');

  // Apply semaphore modifications if needed.
  $conversion = apdqc_semaphore_conversion();
  if ($conversion == 1) {
    apdqc_admin_convert_table_to_memory();
  }
  elseif ($conversion == 2) {
    apdqc_admin_convert_semaphore_table_to_innodb();
  }

  // Collation of tables.
  apdqc_admin_convert_table_collations_to(FALSE, $collation);

  // Convert cache table indexes.
  apdqc_admin_convert_tables_indexes();

  // Convert sessions table.
  apdqc_admin_sessions_table_update_schema();

  // Convert sessions table.
  apdqc_admin_semaphore_table_update_schema();

  // Bring site back online if it was online before.
  if (empty($maintenance_mode)) {
    variable_del('maintenance_mode');
  }
}