diff --git a/Containers/borgbackup/backupscript.sh b/Containers/borgbackup/backupscript.sh index 03bd7b34..c3c74e31 100644 --- a/Containers/borgbackup/backupscript.sh +++ b/Containers/borgbackup/backupscript.sh @@ -15,11 +15,6 @@ get_expiration_time() { DURATION_READABLE=$(printf "%02d hours %02d minutes %02d seconds" $DURATION_HOUR $DURATION_MIN $DURATION_SEC) } -# Export defaults -export BORG_PASSPHRASE="$BORG_PASSWORD" -export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes -export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes - # Test if all volumes aren't empty VOLUME_DIRS="$(find /nextcloud_aio_volumes -mindepth 1 -maxdepth 1 -type d)" mapfile -t VOLUME_DIRS <<< "$VOLUME_DIRS" @@ -168,7 +163,7 @@ if [ "$BORG_MODE" = restore ]; then # Perform the restore if [ -n "$SELECTED_RESTORE_TIME" ]; then - SELECTED_ARCHIVE"$(borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | grep "$SELECTED_RESTORE_TIME" | awk -F " " '{print $1}' | head -1)" + SELECTED_ARCHIVE="$(borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | grep "$SELECTED_RESTORE_TIME" | awk -F " " '{print $1}' | head -1)" else SELECTED_ARCHIVE="$(borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | awk -F " " '{print $1}' | sort -r | head -1)" fi diff --git a/Containers/borgbackup/start.sh b/Containers/borgbackup/start.sh index 8781db49..7464cc6e 100644 --- a/Containers/borgbackup/start.sh +++ b/Containers/borgbackup/start.sh @@ -9,7 +9,10 @@ if [ -z "$BORG_PASSWORD" ]; then exit 1 fi -export BORG_PASSWORD +# Export defaults +export BORG_PASSPHRASE="$BORG_PASSWORD" +export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes +export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes # Validate BORG_MODE if [ "$BORG_MODE" != backup ] && [ "$BORG_MODE" != restore ] && [ "$BORG_MODE" != check ]; then diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 2a6c47fe..075c7fef 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -64,7 +64,7 @@ class ConfigurationManager } $content = file_get_contents(DataConst::GetBackupArchivesList()); - if (count($content) === 0) { + if ($content === '') { return ''; } @@ -85,23 +85,25 @@ class ConfigurationManager public function GetBackupTimes() : array { if (!file_exists(DataConst::GetBackupArchivesList())) { - return $array[] = ''; + return []; } $content = file_get_contents(DataConst::GetBackupArchivesList()); - if (count($content) === 0) { - return $array[] = ''; + if ($content === '') { + return []; } - $backupLines = explode('\n', $content); + $backupLines = explode("\n", $content); $backupTimes = []; foreach($backupLines as $lines) { - $backupTimesTemp = explode(',', $lines); - $backupTimes[] = $backupTimesTemp[1]; + if ($lines !== "") { + $backupTimesTemp = explode(',', $lines); + $backupTimes[] = $backupTimesTemp[1]; + } } if (!is_array($backupTimes)) { - return $array[] = ''; + return []; } return $backupTimes; diff --git a/php/templates/containers.twig b/php/templates/containers.twig index b9b90fe5..6f43d5c9 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -212,7 +212,7 @@