Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasgrimm committed Mar 12, 2016
1 parent 18cb45a commit 9c57926
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Services/LogKeeperService.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private function localWork()

foreach ($logs as $log) {

$this->logger->info("Analising {$log}");
$this->logger->info("Analysing {$log}");

$days = LogUtil::diffInDays($log, $this->today);

Expand All @@ -88,19 +88,21 @@ private function localWork()
if (($days > $this->localRetentionDays) && ($days <= $this->remoteRetentionDaysCalculated)) {
$compressedName = "{$log}.tar.bz2";

$this->logger->info("Compressing {$log} into {$compressedName}");

$this->localRepo->compress($log, $compressedName);
$content = $this->localRepo->get($compressedName);

if ($this->config['enabled_remote']) {
$this->logger->info("Compressing {$log} into {$compressedName}");

$this->localRepo->compress($log, $compressedName);
$content = $this->localRepo->get($compressedName);
$this->remoteRepo->put($compressedName, $content);

$this->logger->info("Deleting $compressedName locally");
$this->localRepo->delete($compressedName);
} else {
$this->logger->info("Deleting $log locally");
$this->localRepo->delete($log);

$this->logger->info("Not uploading {$compressedName} because enabled_remote is false");
}

$this->logger->info("Deleting $compressedName locally");
$this->localRepo->delete($compressedName);
} elseif (($days > $this->localRetentionDays) && ($days > $this->remoteRetentionDaysCalculated)) {
$this->logger->info("Deleting {$log} because it is to old to be kept either local our remotely");

Expand Down

0 comments on commit 9c57926

Please sign in to comment.