/** * @param $manifestPath * @param string $devicePath * @param bool|null $skipFormat * @param bool|null $dryRun */ public function createJob($manifestPath, $devicePath, $skipFormat = null, $dryRun = null) { $manifestPath = (string) $manifestPath; if (!preg_match('/^\\//', $manifestPath)) { $manifestPath = getcwd() . '/' . $manifestPath; } $devicePath = (string) $devicePath; $skipFormat = (bool) $skipFormat; $dryRun = (bool) $dryRun; $awsBackupManager = $this->_getBackupManager(); $this->_getStreamOutput()->writeln('Preparing backup device'); $device = new S3Export_Device($devicePath); if (!$skipFormat) { $device->format(); } $device->mount(); $this->_getStreamOutput()->writeln('Creating AWS backup job'); $manifestFile = new CM_File($manifestPath); $job = $awsBackupManager->createJob($manifestFile->read(), $dryRun); $this->_getStreamOutput()->writeln("Job created, id: `{$job->getId()}`"); $this->_getStreamOutput()->writeln('Storing AWS Signature on backup device'); $awsBackupManager->storeJobSignatureOnDevice($job, $device); $device->unmount(); }
/** * @param S3Export_AwsBackupJob $job * @param S3Export_Device $device */ public function storeJobSignatureOnDevice(S3Export_AwsBackupJob $job, S3Export_Device $device) { $file = new CM_File('SIGNATURE', $device->getFilesystem()); $file->write($job->getSignature()); }