Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$config->backup_auto_storage == 1 does not return file for creating backups #131

Open
NinaHerrmann opened this issue Oct 19, 2021 · 2 comments

Comments

@NinaHerrmann
Copy link
Contributor

When $config->backup_auto_storage is set to one
image
Backups are not created as no file is returned

@NJahreis
Copy link

NJahreis commented Jan 11, 2022

Hi Nina,
I am also affected by this issue. I have found that the backups are returned but are saved to the folder specified in $config->backup_auto_destination instead of the tool_lifecycle -> backup_path. The backups are also generated in each run of "\tool_lifecycle\task\lifecycle_task" but the step for the course does not advance without the backup in the correct folder.

Is there a workaround for the issue at the moment which i could test?
Greetings from Bayreuth
Nikolai

@NinaHerrmann
Copy link
Contributor Author

Hey Nikolai,
to be honest we did a not so nice fix namely:

diff --git a/classes/local/manager/backup_manager.php b/classes/local/manager/backup_manager.php
index e239bdc..35a003e 100644
--- a/classes/local/manager/backup_manager.php
+++ b/classes/local/manager/backup_manager.php
@@ -74,9 +74,12 @@ class backup_manager {
             $results = $bc->get_results(); // Get the file information needed.
             /* @var $file \stored_file instance of the backup file*/
             $file = $results['backup_destination'];
-            if (!empty($file)) {
-                $file->copy_content_to($path . DIRECTORY_SEPARATOR . $archivefile);
-                $file->delete();
+           // TODO Hotfix
+            /* @var $file \stored_file instance of the backup file*/
+            $filepath = $results['backup_destination'];
+            
+            if (!empty($filepath)) {
+                @rename($filepath, $path . DIRECTORY_SEPARATOR . $archivefile);
             }
             $bc->destroy();
             unset($bc);

Additionally, we changed /backup/util/helper/backup_helper.class.php line 300

if (@rename($filepath, $filedest)) {
-    return null;
+   return $filedest;
}

I know core fixes are not the best approach, but it was the fastest fix we could find.
I hope it helps you, if you have any better ideas please contact us!
Cheers and Greetings, Nina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants