Skip to content

Commit

Permalink
Fixed exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
Commifreak committed Mar 29, 2023
1 parent 7dfa708 commit b159d67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/include/ABHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ public static function backupContainer($container, $destination) {
foreach ($excludes as $exclude) {
$exclude = rtrim($exclude, "/");
if (!empty($exclude)) {
if (str_starts_with($exclude, $dockerAppdataPath)) {
self::backupLog("exclude is within appdata apth: stripping appdata path", self::LOGLEVEL_DEBUG);
$exclude = ltrim(str_replace($dockerAppdataPath, '', $exclude), '/');
}
array_unshift($tarOptions, '--exclude ' . escapeshellarg($exclude)); // Add excludes to the beginning - https://unix.stackexchange.com/a/33334
array_unshift($tarVerifyOptions, '--exclude ' . escapeshellarg($exclude)); // Add excludes to the beginning - https://unix.stackexchange.com/a/33334
}
Expand Down
1 change: 1 addition & 0 deletions src/scripts/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
$backupDate = date_create_from_format("??_Ymd_His", $correctedItem);
if (!$backupDate) {
ABHelper::backupLog("Cannot create date from " . $correctedItem, ABHelper::LOGLEVEL_DEBUG);
$toKeep[] = $backupItem; // Keep the errornous object - Better safe than sorry.
continue;
}
if ($backupDate >= $nowDate && !in_array($backupItem, $toKeep)) {
Expand Down

0 comments on commit b159d67

Please sign in to comment.