Skip to content

Commit

Permalink
Check if ZIP file gets created properlyi
Browse files Browse the repository at this point in the history
See #21
  • Loading branch information
rvogel committed Jun 25, 2024
1 parent d7474aa commit cb7772d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Commands/WikiBackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,11 @@ protected function execute( Input\InputInterface $input, OutputInterface $output
$this->addCustomFilesAndFolders();
$this->dumpDatabase();

$this->zip->close();
$success = $this->zip->close();
$this->cleanUp();
if ( !$success ) {
throw new \Exception( "Could not close ZIP file!" );
}

$this->removeOldBackups();

Expand Down Expand Up @@ -205,10 +208,13 @@ protected function initZipFile() {
$destFilePath = $this->makeDestFilepath();
$this->output->writeln( "Creating file '$destFilePath' ..." );
$this->zip = new ZipArchive();
$this->zip->open(
$success = $this->zip->open(
$destFilePath,
ZipArchive::CREATE|ZipArchive::OVERWRITE
);
if ( !$success ) {
throw new \Exception( "Could not create ZIP file '$destFilePath'!" );
}
}

protected function makeDestFilepath() {
Expand Down

0 comments on commit cb7772d

Please sign in to comment.