From 90ad3e7781ae2bf480f2a412f93736c52b2ce1cf Mon Sep 17 00:00:00 2001 From: Blasman Date: Wed, 14 Aug 2024 14:03:23 -0400 Subject: [PATCH 1/4] Update ABSettings.php --- src/include/ABSettings.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/include/ABSettings.php b/src/include/ABSettings.php index f0ed701..7618bb8 100644 --- a/src/include/ABSettings.php +++ b/src/include/ABSettings.php @@ -71,6 +71,8 @@ class ABSettings { public string $preBackupScript = ''; public string $postBackupScript = ''; public string $postRunScript = ''; + public string $preContainerBackupScript = ''; + public string $postContainerBackupScript = ''; public array $includeFiles = []; public array $globalExclusions = []; public string $backupVMMeta = 'yes'; @@ -320,4 +322,4 @@ public function checkCron() { if (!file_exists(ABSettings::$tempFolder)) { mkdir(ABSettings::$tempFolder); -} \ No newline at end of file +} From ffcc02bb28fc379bfafb2adf1f8c9352922e3763 Mon Sep 17 00:00:00 2001 From: Blasman Date: Wed, 14 Aug 2024 14:03:34 -0400 Subject: [PATCH 2/4] Update ABHelper.php --- src/include/ABHelper.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/include/ABHelper.php b/src/include/ABHelper.php index 0c5d897..e52d18a 100644 --- a/src/include/ABHelper.php +++ b/src/include/ABHelper.php @@ -619,10 +619,15 @@ public static function doBackupMethod($method, $containerListOverride = null,) { foreach ($containerListOverride ? array_reverse($containerListOverride) : $sortedStopContainers as $_container) { foreach (self::resolveContainer($_container, true) ?: [$_container] as $container) { self::setCurrentContainerName($container); + + ABHelper::handlePrePostScript($abSettings->preContainerBackupScript, 'pre-container', $container['Name']); + if (!self::backupContainer($container, $abDestination)) { self::$errorOccured = true; } + ABHelper::handlePrePostScript($abSettings->postContainerBackupScript, 'post-container', $container['Name']); + if (self::abortRequested()) { return false; } @@ -684,10 +689,14 @@ public static function doBackupMethod($method, $containerListOverride = null,) { return false; } + ABHelper::handlePrePostScript($abSettings->preContainerBackupScript, 'pre-container', $container['Name']); + if (!self::backupContainer($container, $abDestination)) { self::$errorOccured = true; } + ABHelper::handlePrePostScript($abSettings->postContainerBackupScript, 'post-container', $container['Name']); + if (self::abortRequested()) { return false; } From da363bc266e44d57302f08bd08d7d791c61b66df Mon Sep 17 00:00:00 2001 From: Blasman Date: Wed, 14 Aug 2024 14:03:41 -0400 Subject: [PATCH 3/4] Update settings.php --- src/pages/content/settings.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/pages/content/settings.php b/src/pages/content/settings.php index 7516c02..cb9a97f 100644 --- a/src/pages/content/settings.php +++ b/src/pages/content/settings.php @@ -779,6 +779,30 @@ class="fa fa-info"> Those must return exit code 0 for success detection, true|false (true on backup success, false otherwise)

+
+
Pre-container-backup script
+
+
+ +
+

Runs the selected script for each container immediately BEFORE creating the tarfile. Sent arguments: pre-container, + container name

+
+ +
+
Post-container-backup script
+
+
+ +
+

Runs the selected script for each container immediately AFTER creating the tarfile. Sent arguments: post-container, + container name

+
+
Some extra options
@@ -1065,4 +1089,4 @@ function copyConfigFromProd() { alert('Something went wrong :/') }); } - \ No newline at end of file + From a839dfc0702d9496e8d0832cc5a08422069c16da Mon Sep 17 00:00:00 2001 From: Robin Kluth Date: Fri, 16 Aug 2024 06:49:47 +0200 Subject: [PATCH 4/4] Changed display order of new pre/post Container settings --- src/pages/content/settings.php | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/pages/content/settings.php b/src/pages/content/settings.php index cb9a97f..6a8a24d 100644 --- a/src/pages/content/settings.php +++ b/src/pages/content/settings.php @@ -756,51 +756,51 @@ class="fa fa-info"> Those must return exit code 0 for success detection
-
Post-backup script
-
Pre-container-backup script +
-

Runs the selected script AFTER the backup is done (before containers would start). Sent arguments: post-backup, - destination path

+

Runs the selected script for each container immediately BEFORE creating the tarfile. Sent arguments: pre-container, + container name

-
Post-run script
-
Post-container-backup script +
-

Runs the selected script AFTER everything is done. Sent arguments: post-run, destination - path, true|false (true on backup success, false otherwise)

+

Runs the selected script for each container immediately AFTER creating the tarfile. Sent arguments: post-container, + container name

-
Pre-container-backup script
-
Post-backup script +
-

Runs the selected script for each container immediately BEFORE creating the tarfile. Sent arguments: pre-container, - container name

+

Runs the selected script AFTER the backup is done (before containers would start). Sent arguments: post-backup, + destination path

-
Post-container-backup script
-
Post-run script +
-

Runs the selected script for each container immediately AFTER creating the tarfile. Sent arguments: post-container, - container name

+

Runs the selected script AFTER everything is done. Sent arguments: post-run, destination + path, true|false (true on backup success, false otherwise)

Some extra options