/**
  * @param $statusCallback
  * @param $destDumpFile
  * @return bool True if succeeded or kept the file.  False if failed.
  */
 private function deleteDestDumpFile($statusCallback, $destDumpFile)
 {
     $success = $this->dest->deleteDumpFile($destDumpFile);
     // if null, we kept the file
     if ($success === null) {
         $this->doStatusCallback(new Status("Keeping dest dump file ({$destDumpFile}).", Status::MT_NOTICE), $statusCallback);
         return true;
     } else {
         if ($success) {
             $this->doStatusCallback(new Status("Deleted dest dump file ({$destDumpFile}).", Status::MT_NOTICE), $statusCallback);
             return true;
         } else {
             // we may have failed because this is a local to local copy, just
             // indicate that in the status
             if ($this->source->getOptions()->isLocal() && $this->source->getOptions()->isLocal()) {
                 $this->doStatusCallback(new Status("Failed to delete source dump file ({$destDumpFile}). It may have already been deleted in a previous step.", Status::MT_ERROR), $statusCallback);
             } else {
                 $this->doStatusCallback(new Status("Failed to delete source dump file ({$destDumpFile}).", Status::MT_ERROR), $statusCallback);
             }
             // always return false on failure
             return false;
         }
     }
 }
 /**
  * Will copy the file from the source to the destination.
  *
  * If this is a local to local copy, and the destination is the same as the source,
  * it won't be copied (since it's already at it's destination).
  *
  * @param string    $sourceDumpFile     Path to source file.
  * @param Machine   $dest
  * @param string|null $localTmp         If this is a remote to remote copy, pass the localTmp
  *
  * @throws \InvalidArgumentException    If the copy failed because of an invalid parameter.
  *
  * @return string|bool  False if failed, otherwise the path to the dump file on the destination.
  */
 public function copyDumpFile($sourceDumpFile, Machine $dest, $localTmp = null)
 {
     $destDumpFile = $dest->generateDumpFilePath();
     // don't copy if this is a local to local sync, and the source and dest are
     // the same (it's already where we want it to be)
     if (!$this->getOptions()->isLocal() || !$dest->getOptions()->isLocal() || $sourceDumpFile != $destDumpFile) {
         $copier = new Copier($this->options->getSsh(), $dest->getOptions()->getSsh(), $localTmp);
         try {
             if (!$copier->copy($sourceDumpFile, $destDumpFile)) {
                 return false;
             }
         } catch (\UnexpectedValueException $e) {
             throw new \InvalidArgumentException($e->getMessage());
         } catch (\InvalidArgumentException $e) {
             throw new \InvalidArgumentException($e->getMessage());
         }
     }
     return $destDumpFile;
 }