Skip to content

Commit

Permalink
Fix 'deleteTarget' simulation problem - issue #113
Browse files Browse the repository at this point in the history
There was an error if the 'deleteTarget' option was activated
during simulation. The target is getting added to the files
to delete list and the Cleaner was trying to get the MTime
and Size from a file that doesn't exist.
To fix this we deactivate the option during simulation and
add some hints to the output, that the target will be deleted
as well.
  • Loading branch information
sebastianfeldmann committed Sep 19, 2017
1 parent 273c090 commit c705261
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Backup/Cleaner/Capacity.php
Expand Up @@ -78,6 +78,15 @@ public function simulate(Target $target, Collector $collector, Result $result)
{
$target->setSize('20000000');
$result->debug('assuming backup size 20MB');

// because there is no target file on disc to read
// we have to deactivate the target handling
// so $targetFile->getMTime or $targetFile->getSize will not be called
if ($this->deleteTarget) {
$this->deleteTarget = false;
$result->debug('target will be deleted as well');
$result->debug('delete ' . $target->getPathname());
}
parent::simulate($target, $collector, $result);
}

Expand Down

0 comments on commit c705261

Please sign in to comment.