You are here

function og_migrate_finished in Organic groups 7

Batch finish callback.

1 string reference to 'og_migrate_finished'
og_migrate_batch in og_migrate/og_migrate.module
Helper function to create a batch.

File

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

Code

function og_migrate_finished($success, $results, $operations) {
  $batch = batch_get();
  $plugins_name = $batch['sets'][0]['og_migrate_plugins'];
  if ($success) {
    $message = format_plural(count($results), 'One post processed.', '@count posts processed.');
    $status = OG_MIGRATE_EXECUTED;
  }
  else {
    $message = t('Finished with an error.');
    $status = OG_MIGRATE_FAILED;
  }
  drupal_set_message($message);

  // TODO: This is not correct, as if there will be an error then all we be set
  // to failed.
  // Set the status in the database.
  foreach ($plugins_name as $plugin_name) {
    og_migrate_write_record($plugin_name, $status);
  }
  if (!empty($results)) {
    foreach ($results as $result) {

      // TODO: add results.
      // $items[] = t('Loaded node %title.', array('%title' => $result));
    }

    // Providing data for the redirected page is done through $_SESSION.

    //$_SESSION['og_migrate_results'] = $items;
  }
}