You are here

function og_migrate_batch in Organic groups 7

Helper function to create a batch.

1 call to og_migrate_batch()
og_migrate_admin_submit in og_migrate/og_migrate.module
Submit handler.

File

og_migrate/og_migrate.module, line 357
Migrate and upgrade Organic groups data.

Code

function og_migrate_batch($plugins_name) {
  $plugins_name = og_migrate_get_plugins_dependencies($plugins_name);
  if (!$plugins_name) {
    return;
  }

  // Add the operations.
  $plugins = og_migrate_get_plugins();
  foreach ($plugins_name as $plugin_name) {
    $operations[] = array(
      $plugins[$plugin_name]['migrate callback'],
      array(),
    );
  }
  $batch = array(
    'title' => t('Migrating Organic groups data'),
    'operations' => $operations,
    'finished' => 'og_migrate_finished',
    'init_message' => t("Organic groups migration is starting."),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Organic groups migration has encountered an error.'),
    // This is our own key, used to retrieve the list of plugins that were
    // called.
    'og_migrate_plugins' => $plugins_name,
  );
  batch_set($batch);
}