Inheritance: extends Bravo3\Orm\Enum\OrmEnum
Exemple #1
0
 /**
  * Archive cleanup
  */
 public function __destruct()
 {
     // Compress the archive on exit
     if ($this->compression != Compression::NONE()) {
         // Due to the way Phar works, it MUST create a new archive with a different extension. We will allow this,
         // then rename the new archive back to the original filename
         $ext = uniqid();
         $fn = substr($this->filename, 0, strrpos($this->filename, '.') ?: null);
         $this->archive->compress((int) $this->compression->value(), $ext);
         // New archive does not get created on empty databases
         if (file_exists($fn . '.' . $ext)) {
             rename($fn . '.' . $ext, $this->filename);
         }
     }
 }
Exemple #2
0
 protected function getTarDriver()
 {
     $fn = sys_get_temp_dir() . '/bravo3-orm/tar.db';
     if (file_exists($fn)) {
         unlink($fn);
     }
     return new FilesystemDriver(new PharIoDriver($fn, ArchiveType::TAR(), Compression::BZIP2()));
 }