Example #1
0
 protected function getZipDriver()
 {
     $fn = sys_get_temp_dir() . '/bravo3-orm/zip.db';
     if (file_exists($fn)) {
         unlink($fn);
     }
     return new FilesystemDriver(new PharIoDriver($fn, ArchiveType::ZIP()));
 }
Example #2
0
 /**
  * Create a tar or zip I/O driver
  *
  * @param string      $filename     Path to database file
  * @param ArchiveType $archive_type Tar or zip archive
  * @param Compression $compression  Compression not supported by zip archives
  */
 public function __construct($filename, ArchiveType $archive_type, Compression $compression = null)
 {
     $this->filename = $filename;
     $this->archive = new \PharData($filename, null, null, $archive_type->value());
     $this->compression = $compression ?: Compression::NONE();
     if ($archive_type == ArchiveType::ZIP() && $this->compression != Compression::NONE()) {
         throw new NotSupportedException("You cannot use compression with zip databases");
     }
 }