Esempio n. 1
0
 /**
  * Set the backup configurations.
  *
  * @param  \phpbu\App\Configuration $configuration
  * @throws \phpbu\App\Exception
  */
 public function setBackups(Configuration $configuration)
 {
     if (!isset($this->json['backups'])) {
         throw new Exception('no backup configured');
     }
     foreach ($this->json['backups'] as $backup) {
         $configuration->addBackup($this->getBackupConfig($backup));
     }
 }
 protected function archiveBackup(Configuration $configuration, $sourcePath, $targetPath, $targetFilename, $compress)
 {
     // Create a backup
     $name = $this->identifier . '-archive-' . str_random(8);
     $backup = app(Backup::class, [$name, false]);
     // Define the options
     $sourceOptions = ['path' => $sourcePath, 'removeDir' => true, 'showStdErr' => true];
     // Define a source and a target based on those options
     $source = app(Source::class, ['tar', $sourceOptions]);
     $target = app(Target::class, [$targetPath, $targetFilename, $compress]);
     // Persist the source and the target in the backup
     $backup->setSource($source);
     $backup->setTarget($target);
     // Add backup to runner configuration
     $configuration->addBackup($backup);
 }
Esempio n. 3
0
 /**
  * Set the backup configurations.
  *
  * @param  \phpbu\App\Configuration $configuration
  * @throws \phpbu\App\Exception
  */
 public function setBackups(Configuration $configuration)
 {
     foreach ($this->xpath->query('backups/backup') as $backupNode) {
         $configuration->addBackup($this->getBackupConfig($backupNode));
     }
 }