You are here

function _optimizedb_list_tables_operation_execute_run in OptimizeDB 8

Same name and namespace in other branches
  1. 6 optimizedb.module \_optimizedb_list_tables_operation_execute_run()
  2. 7 optimizedb.module \_optimizedb_list_tables_operation_execute_run()

Batch callback: Common tasks checking, repairs and optimizes tables.

Parameters

array $param: Table names and types of operations.

array $context: Reference to an array used for Batch API storage.

1 string reference to '_optimizedb_list_tables_operation_execute_run'
_optimizedb_list_tables_operation_execute in ./optimizedb.module
Performing operations on tables.

File

./optimizedb.module, line 109
Database Optimization.

Code

function _optimizedb_list_tables_operation_execute_run(array $param, array &$context) {
  $operation_result = \Drupal::database()
    ->query($param['operation'] . ' ' . $param['name'])
    ->fetchAll();
  foreach ($operation_result as $result) {
    if (isset($result->Msg_type) && in_array(strtolower($result->Msg_type), [
      'error',
      'warning',
    ])) {
      $context['results']['errors'][] = [
        [
          'data' => $param['name'],
        ],
        [
          'data' => $result->Msg_type,
        ],
        [
          'data' => $result->Msg_text,
        ],
      ];
    }
  }
}