Skip to content

Commit 98eb2f7

Browse files
Fix file collector cache issue
If the collector was used before encrypting the file, e.g. for a size check the file cache inside the collector still held the uncrypted file. To fix this two independent collectors where used.
1 parent 355135f commit 98eb2f7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Runner/Backup.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use phpbu\App\Backup\Source;
66
use phpbu\App\Exception;
77
use phpbu\App\Backup\Cleaner;
8-
use phpbu\App\Backup\Collector\Local;
8+
use phpbu\App\Backup\Collector;
99
use phpbu\App\Backup\Crypter;
1010
use phpbu\App\Backup\Sync;
1111
use phpbu\App\Backup\Target;
@@ -60,7 +60,6 @@ public function run(Configuration $configuration) : Result
6060
// setup target and collector, reset failure state
6161
$target = $this->factory->createTarget($backup->getTarget());
6262
$source = $this->factory->createSource($backup->getSource()->type, $backup->getSource()->options);
63-
$collector = new Local($target);
6463
$this->failure = false;
6564

6665
try {
@@ -76,7 +75,7 @@ public function run(Configuration $configuration) : Result
7675
* / /__/ _ / _// /__/ ,< _\ \
7776
* \___/_//_/___/\___/_/|_/___/
7877
*/
79-
$this->executeChecks($backup, $target, $collector);
78+
$this->executeChecks($backup, $target, new Collector\Local($target));
8079

8180
/* __________ _____ ______
8281
* / ___/ _ \ \/ / _ \/_ __/
@@ -97,7 +96,7 @@ public function run(Configuration $configuration) : Result
9796
* / /__/ /__/ _// __ |/ / /_/ / ___/
9897
* \___/____/___/_/ |_/_/|_/\____/_/
9998
*/
100-
$this->executeCleanup($backup, $target, $collector);
99+
$this->executeCleanup($backup, $target, new Collector\Local($target));
101100
} catch (\Exception $e) {
102101
$this->result->debug('exception: ' . $e->getMessage());
103102
$this->result->addError($e);
@@ -136,7 +135,7 @@ protected function executeSource(Configuration\Backup $conf, Target $target, Sou
136135
* @param \phpbu\App\Backup\Collector\Local $collector
137136
* @throws \Exception
138137
*/
139-
protected function executeChecks(Configuration\Backup $backup, Target $target, Local $collector)
138+
protected function executeChecks(Configuration\Backup $backup, Target $target, Collector\Local $collector)
140139
{
141140
foreach ($backup->getChecks() as $config) {
142141
try {
@@ -221,7 +220,7 @@ protected function executeSyncs(Configuration\Backup $backup, Target $target)
221220
* @param \phpbu\App\Backup\Collector\Local $collector
222221
* @throws \phpbu\App\Exception
223222
*/
224-
protected function executeCleanup(Configuration\Backup $backup, Target $target, Local $collector)
223+
protected function executeCleanup(Configuration\Backup $backup, Target $target, Collector\Local $collector)
225224
{
226225
if ($backup->hasCleanup()) {
227226
/* @var \phpbu\App\Configuration\Backup\Cleanup $config */

0 commit comments

Comments
 (0)