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

Add timestamp to backup directory #299

Merged
merged 4 commits into from
Sep 15, 2020
Merged

Conversation

nickvergessen
Copy link
Member

No description provided.

@MorrisJobke
Copy link
Member

Why is this needed? The folder is deleted if it was there? And then it should not cause problems.

@nickvergessen
Copy link
Member Author

Well if you cancel and restart for whatever reason, you will get a mixed state in there. alternatively we could delete and recreate the folder.

@MorrisJobke
Copy link
Member

Well if you cancel and restart for whatever reason, you will get a mixed state in there. alternatively we could delete and recreate the folder.

But this is deleted right below the line you changed. 🤔

@nickvergessen
Copy link
Member Author

Hmm @schiessle had this on his own instance and with a customer

@MorrisJobke
Copy link
Member

Hmm @schiessle had this on his own instance and with a customer

What's in the updater log file?

@schiessle
Copy link
Member

schiessle commented Sep 11, 2020

While looking at the code and thinking about the situation again I think the issue was the following:

  1. They started the update process
  2. The updater already started replacing the files
  3. updater process stopped in between because of some broken read/write permissions
  4. They started the updater again.
  5. Now the first backup was replaced with the backup of the mixed up version
  6. Now they where in the state that they had no more backup from before the first try but only the mixed up one.

This could be solved by keeping the previous backups and not replacing them. Either by adding a timestamp (like suggested by Joas) or a counter to the backups.

Copy link
Member

@schiessle schiessle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this should make the update routine more robust and make sure that no backups are lost if the update process has to be restarted.

@kesselb
Copy link
Contributor

kesselb commented Sep 15, 2020

if(file_exists($backupFolderLocation)) {
    $this->silentLog('[info] backup folder location exists');
    $this->recursiveDelete($backupFolderLocation);
}

Can go. It's super unlikely that a folder that includes a timestamp already exist.

@MorrisJobke MorrisJobke merged commit ec583b8 into master Sep 15, 2020
@delete-merged-branch delete-merged-branch bot deleted the nickvergessen-patch-1 branch September 15, 2020 14:19
@MorrisJobke
Copy link
Member

/backport to stable19

@backportbot-nextcloud
Copy link

The backport to stable19 failed. Please do this backport manually.

@MorrisJobke
Copy link
Member

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

Successfully merging this pull request may close these issues.

4 participants