From 8e56da31ffc9098d3972c7cae6aab7c283068960 Mon Sep 17 00:00:00 2001 From: Maarten de Keizer Date: Mon, 20 Nov 2023 13:40:55 +0100 Subject: [PATCH] Small bugfixes --- src/Command/BackupCommand.php | 4 +++- src/Command/CleanUpCommand.php | 4 +++- src/Profile/Profile.php | 2 +- src/Profile/Tmp.php | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Command/BackupCommand.php b/src/Command/BackupCommand.php index b6ae6fc..08e2a07 100644 --- a/src/Command/BackupCommand.php +++ b/src/Command/BackupCommand.php @@ -51,7 +51,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (file_exists(dirname($profile->logFile)) === false) { mkdir(dirname($profile->logFile), 0777, true); } - $profileLogger = $profileLogger->withStream(fopen($profile->logFile, 'a')); + if ($profile->logFile) { + $profileLogger = $profileLogger->withStream(fopen($profile->logFile, 'a')); + } } try { diff --git a/src/Command/CleanUpCommand.php b/src/Command/CleanUpCommand.php index b061fa0..1981a47 100644 --- a/src/Command/CleanUpCommand.php +++ b/src/Command/CleanUpCommand.php @@ -50,7 +50,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (file_exists(dirname($profile->logFile)) === false) { mkdir(dirname($profile->logFile), 0777, true); } - $profileLogger = $profileLogger->withStream(fopen($profile->logFile, 'a')); + if ($profile->logFile) { + $profileLogger = $profileLogger->withStream(fopen($profile->logFile, 'a')); + } } try { diff --git a/src/Profile/Profile.php b/src/Profile/Profile.php index 06f4e33..9aaac19 100644 --- a/src/Profile/Profile.php +++ b/src/Profile/Profile.php @@ -36,7 +36,7 @@ public static function fromArray(array $data): self TargetFactory::fromArray($data['target']), RetentionFactory::fromArray($data['retention']), NotificationFactory::fromArray($data['notifications']), - $data['log'] + $data['log'] ?? null ); } } \ No newline at end of file diff --git a/src/Profile/Tmp.php b/src/Profile/Tmp.php index 6fa5d53..a292bb4 100644 --- a/src/Profile/Tmp.php +++ b/src/Profile/Tmp.php @@ -16,6 +16,8 @@ public function __construct( public static function fromArray(array $data): self { + $data['mode'] = $data['mode'] ?? '0777'; + return new self($data['path'], intval($data['mode'])); } } \ No newline at end of file