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

Running pm-updatecode on Core Without Backups Deletes Non-Core Files and Directories #2275

Closed
KeyboardCowboy opened this issue Jul 15, 2016 · 1 comment

Comments

@KeyboardCowboy
Copy link

Summary:

When updating modules and core with Drush, the existing code is moved to a backup location before the new code replaces it. If there is an error, the old code can roll back over the new code, restoring the system. The pm-updatecode command accepts an option --no-backups that prevents these backups from taking place, which I find useful when using git to manage my projects. I don't need the extra disk space used up with code backups.

Issue:

Most projects have additional files at the docroot, such as Google or Bing authentication files. When updating core with backups ON, these files remain intact. With backups off ($options['no-backups'] = TRUE), these files are lost. Also any non-core profiles are deleted.

Expected Result:

Any non-core files and directories I have in the docroot or profiles/* remain intact after updating core, regardless of whether I am backing up the code or not.

Actual Result:

Non-core files are lost after updating when --no-backup is set.

Proposed Solutions:

Users Can Fix:

  1. Don't turn backups off. This may increase processing time and bloat your drush-backups folder, but you won't lose files.
  2. Change the backup directory to a tmp location so backups are cleaned out. $options['backup-dir'] = '/tmp/drush-backups';

Drush Fixes:

  1. It looks like there are a couple of existing issues that might resolve this. [Update Drupal core without moving core files out of the way #4], [Provide a way to not delete files or folders during pm-update drupal #614]
  2. If the user has --no-backups set, store backups to a tmp directory instead of ignoring them.

From what I can find, the offending code appears to be here:
https://github.com/drush-ops/drush/blob/master/commands/pm/updatecode.pm.inc#L215:L221

@weitzman
Copy link
Member

Thanks for the clear writeup. I do think this issue is a dupe of both the issues you linked to. Fragmented discussion is not helpful so closing this.

I'll note that sites built with https://github.com/drupal-composer/drupal-project dont suffer from this problem, mainly because the dont use pm-updatecode. Thats how all D8+ sites should be built and even D7 sites should consider it.

Given available workarounds, I doubt this will ever get fixed.

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