コード例 #1
0
ファイル: Directory.php プロジェクト: todiadiyatmo/phpbu
 /**
  * Returns the executable for this action.
  *
  * @param  \phpbu\App\Backup\Target $target
  * @return \phpbu\App\Cli\Executable
  */
 public function getExecutable(Target $target)
 {
     if (null === $this->executable) {
         $this->executable = new Tar($this->pathToCommand);
         $this->executable->archiveDirectory($this->path);
         $archiveName = Tar::isCompressorValid($target->getCompressor()->getCommand()) ? $target->getPathname() : $target->getPathnamePlain();
         $this->executable->archiveTo($archiveName)->useCompression($target->getCompressor()->getCommand())->removeSourceDirectory(true);
     }
     return $this->executable;
 }
コード例 #2
0
ファイル: Tar.php プロジェクト: imjerrybao/phpbu
 /**
  * Setup the Executable to run the 'tar' command.
  *
  * @param  \phpbu\App\Backup\Target
  * @return \phpbu\App\Cli\Executable
  */
 public function getExecutable(Target $target)
 {
     if (null == $this->executable) {
         // check if tar supports requested compression
         if ($target->shouldBeCompressed()) {
             if (!Executable\Tar::isCompressorValid($target->getCompressor()->getCommand())) {
                 $this->pathToArchive = $target->getPathnamePlain();
             } else {
                 // compression could be handled by the tar command
                 $this->pathToArchive = $target->getPathname();
                 $this->compression = $target->getCompressor()->getCommand();
             }
         } else {
             // no compression at all
             $this->pathToArchive = $target->getPathname();
         }
         $this->executable = new Executable\Tar($this->pathToTar);
         $this->executable->archiveDirectory($this->path)->useCompression($this->compression)->archiveTo($this->pathToArchive)->showStdErr($this->showStdErr);
     }
     return $this->executable;
 }
コード例 #3
0
ファイル: Directory.php プロジェクト: imjerrybao/phpbu
 /**
  * If 'tar' can't compress with the requested compressor this will return false.
  *
  * @param  \phpbu\App\Backup\Target $target
  * @return bool
  */
 public function canCompress(Target $target)
 {
     return Tar::isCompressorValid($target->getCompressor()->getCommand());
 }