You are here

function _acquia_migrate_transmit_chunk in Acquia Connector 6.2

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

File

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

Code

function _acquia_migrate_transmit_chunk(&$migration, $position, $length) {

  // Open file in binary mode.
  $handle = fopen($migration['tar_file'], 'rb');

  // Move to position in file.
  if ($position) {
    fseek($handle, $position);
  }
  $contents = fread($handle, $length);

  // Pass starting position.
  $migration['request_params']['position'] = $position;

  // Transfer contents.
  $result = _acquia_migrate_transmit($migration, $contents);

  // Set position to FALSE if the whole file has been read or if transmit failed.
  if (feof($handle) || $result === FALSE) {
    $position = FALSE;
  }
  else {

    // Get current position.
    $position = ftell($handle);
  }
  fclose($handle);
  return $position;
}