1 system.admin.inc system_utf8mb4_convert_form_submit($form, &$form_state)

Form submit function; convert existing database tables to utf8mb4.

See also

system_utf8mb4_convert_form()

File

core/modules/system/system.admin.inc, line 2618
Admin page callbacks for the System module.

Code

function system_utf8mb4_convert_form_submit($form, &$form_state) {
  global $databases;

  // Enter maintenance mode.
  state_set('maintenance_mode', TRUE);

  // Build the list of tables to convert.
  $database = $databases['default']['default'];
  $like = '';
  if (!empty($database['prefix'])) {
    $like = ' LIKE "' . $database['prefix'] . '%"';
  }
  $table_names = db_query('SHOW TABLES' . $like)->fetchCol();

  $batch = array(
    'operations' => array(
      array('_system_utf8mb4_convert_batch', array($table_names))
    ),
    'finished' => '_system_utf8mb4_convert_batch_finished',
    'title' => t('Converting database tables'),
    'progress_message' => '',
    'init_message' => t('Collecting list of tables...'),
    'error_message' => t('The update has encountered an error.'),
    'file' => backdrop_get_path('module', 'system') . '/system.admin.inc',
  );
  batch_set($batch);
}