function _optimizedb_list_tables_operation_execute in OptimizeDB 6
Same name and namespace in other branches
- 8 optimizedb.module \_optimizedb_list_tables_operation_execute()
- 7 optimizedb.module \_optimizedb_list_tables_operation_execute()
Performing operations on tables.
Parameters
array $form: The parameter with the hook - hook_FORM_ID_submit().
array $form_state: The parameter with the hook - hook_FORM_ID_submit().
string $operation_name: The operation to be performed with tables.
3 calls to _optimizedb_list_tables_operation_execute()
- optimizedb_list_tables_check_tables_submit in ./
optimizedb.module - Implements hook_FORM_ID_submit().
- optimizedb_list_tables_optimize_tables_submit in ./
optimizedb.module - Implements hook_FORM_ID_submit().
- optimizedb_list_tables_repair_tables_submit in ./
optimizedb.module - Implements hook_FORM_ID_submit().
File
- ./
optimizedb.module, line 359 - Database Optimization.
Code
function _optimizedb_list_tables_operation_execute($form, $form_state, $operation_name) {
$tables_selected = $form_state['values']['tables'];
if (optimizedb_db_driver() == 'mysql') {
if (!empty($tables_selected)) {
$count = 0;
foreach ($tables_selected as $table => $value) {
if ($table === $value) {
$operations[] = array(
'_optimizedb_list_tables_operation_execute_run',
array(
array(
'name' => $table,
'operation' => $operation_name,
),
),
);
++$count;
}
}
if ($count == 0) {
drupal_set_message(t('To execute, you must select at least one table from the list.'), 'error');
}
else {
$batch = array(
'operations' => $operations,
'finished' => '_optimizedb_list_tables_operation_execute_finished',
);
batch_set($batch);
}
}
else {
drupal_set_message(t('To execute, you must select at least one table from the list.'), 'error');
}
}
else {
drupal_set_message(t('Function to check tables is only available for databases MySQL.'), 'error');
}
}