You are here

function acquia_migrate_batch_finished in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.2 acquia_agent/acquia_agent.migrate.inc \acquia_migrate_batch_finished()
1 string reference to 'acquia_migrate_batch_finished'
acquia_agent_migrate_form_submit in acquia_agent/acquia_agent.pages.inc
Submit handler for Acquia Cloud migrate button.

File

acquia_agent/acquia_agent.migrate.inc, line 289
Upload to Acquia Cloud.

Code

function acquia_migrate_batch_finished($success, $results, $operations) {
  $migration = !empty($results['migration']) ? $results['migration'] : FALSE;
  if ($success && $migration && $migration['error'] == FALSE) {

    // Inform Acquia Cloud of migration completion.
    _acquia_migrate_complete($migration);
    if ($migration['error'] != FALSE) {
      $message = t('There was an error checking for completed migration. !err<br/>See the !network for more information.', array(
        '!err' => $migration['error'],
        '!network' => l('Network dashboard', 'https://network.acquia.com/'),
      ));
      drupal_set_message($message);
    }
    else {
      $message = t('Migrate success. You can see import progress on the !network page.', array(
        '!network' => l(t('Acquia Cloud > Workflow'), $migration['network_url'], array(
          'external' => TRUE,
        )),
      ));
      drupal_set_message($message);
    }

    // Cleanup migration.
    _acquia_migrate_cleanup($migration);
  }
  else {
    watchdog('acquia-migrate', 'Migration error @m', array(
      '@m' => var_export($migration, TRUE),
    ), WATCHDOG_ERROR);
    $message = t('There was an error during migration.');
    if ($migration && is_string($migration['error'])) {
      $message .= ' ' . $migration['error'];
    }
    drupal_set_message($message, 'error');

    // Cleanup anything left of migration.
    _acquia_migrate_cleanup($migration);
  }
  drupal_goto('admin/settings/acquia-agent');
}