protected function getArchive()
{
// if already initialized, just return the handler
if ($this->zipArchive) {
return $this->zipArchive;
}
$this->zipArchive = new \ZipArchive();
if (!is_file($this->getBackupFile())) {
$zipState = $this->zipArchive->open($this->getBackupFile(), \ZipArchive::CREATE);
} else {
$zipState = $this->zipArchive->open($this->getBackupFile());
}
if ($zipState === true) {
return $this->zipArchive;
} else {
throw new \Exception("unable to create zip archive");
}
}