You are here

function _acquia_migrate_cleanup in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.2 acquia_agent/acquia_agent.migrate.inc \_acquia_migrate_cleanup()

Remove files and directory created for migration.

2 calls to _acquia_migrate_cleanup()
acquia_agent_migrate_cleanup_submit in acquia_agent/acquia_agent.pages.inc
acquia_migrate_batch_finished in acquia_agent/acquia_agent.migrate.inc

File

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

Code

function _acquia_migrate_cleanup(&$migration) {
  if (isset($migration['db_file'])) {
    _acquia_migrate_cleanup_db($migration);
  }
  if (isset($migration['tar_file'])) {
    unlink($migration['tar_file']);
    unset($migration['tar_file']);
  }
  if (isset($migration['dir'])) {
    if (is_dir($migration['dir'])) {
      if (!@rmdir($migration['dir'])) {

        // Files leftover in directory, reconstruct names and remove.
        $db_file = $migration['file'] . '.sql';
        if (file_exists($db_file)) {
          unlink($db_file);
        }
        $tar_file = $migration['file'] . '.tar';
        $tar_file .= !empty($migration['compression_ext']) ? '.' . $migration['compression_ext'] : '';
        if (file_exists($tar_file)) {
          unlink($tar_file);
        }
        rmdir($migration['dir']);
      }
    }
    unset($migration['dir']);
  }
  variable_set('acquia_agent_cloud_migration', $migration);
}