You are here

function _acquia_migrate_archive_site in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.2 acquia_agent/acquia_agent.migrate.inc \_acquia_migrate_archive_site()
1 call to _acquia_migrate_archive_site()
acquia_migrate_batch_tar in acquia_agent/acquia_agent.migrate.inc

File

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

Code

function _acquia_migrate_archive_site(&$migration) {
  $exclude = acquia_migrate_exclude($migration);
  $root = getcwd();
  $files = acquia_migrate_files_to_backup($root, $exclude);
  if (!empty($files) && isset($migration['file'])) {
    _acquia_migrate_validate_archive_files($migration, $files);
    if ($migration['error'] != FALSE) {
      return;
    }
    $dest_file = $migration['file'] . '.tar';
    if (!empty($migration['compression_ext'])) {
      $dest_file .= '.' . $migration['compression_ext'];
    }
    $gz = new Archive_Tar($dest_file, $migration['compression_ext'] ? $migration['compression_ext'] : NULL);
    if (!empty($migration['db_file'])) {

      // Add db file.
      $ret = $gz
        ->addModify(array(
        $migration['db_file'],
      ), '', $migration['dir'] . DIRECTORY_SEPARATOR);
    }
    if (defined('OS_WINDOWS')) {
      $remove_dir = $root . '\\';
    }
    else {
      $remove_dir = $root . '/';
    }
    $ret = $gz
      ->addModify($files, '', $remove_dir);
    $migration['tar_file'] = $dest_file;
  }
  else {
    $migration['error'] = TRUE;
  }
}