Exemplo n.º 1
0
 /**
  * (non-PHPDoc)
  *
  * @see    \phpbu\App\Backup\Source
  * @param  \phpbu\App\Backup\Target $target
  * @param  \phpbu\App\Result        $result
  * @return \phpbu\App\Backup\Source\Status
  * @throws \phpbu\App\Exception
  */
 public function backup(Target $target, Result $result)
 {
     // set uncompressed default MIME type
     $target->setMimeType('application/x-tar');
     $status = Status::create();
     $tar = $this->execute($target);
     // if tar doesn't handle the compression mark status uncompressed so the app can take care of compression
     if (!$this->executable->handlesCompression()) {
         $status->uncompressed($target->getPathnamePlain());
     }
     $result->debug($tar->getCmd());
     if (!$tar->wasSuccessful()) {
         throw new Exception('tar failed');
     }
     return $status;
 }