private function dumpSourceDatabaseToFile($statusCallback) { $dumpFile = $this->source->dumpDatabaseToFile(); $this->doStatusCallback(new Status("Dumping source database to file ({$dumpFile}).", Status::MT_NOTICE), $statusCallback); if (!$dumpFile) { $this->doStatusCallback(new Status("Failed to dump source database to file ({$dumpFile}).", Status::MT_ERROR), $statusCallback); return false; } return $dumpFile; }
/** * 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; }