Provide a Drush command for running a quick backup. Should have options similar to what is present in the UI, only without the option to download the file.

Without use drush, I can do a backup without need add a Setting Profile. So I'll change for 'Needs Work'.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DamienMcKenna created an issue. See original summary.

paulocs’s picture

Assigned: Unassigned » paulocs
paulocs’s picture

Assigned: paulocs » Unassigned
Status: Active » Needs review
StatusFileSize
new2.17 KB

Sorry to provide a patch 2 days after I assigned my self.
I was busy those days and forgot about this issue.

Anyway here is patch for it. We should evaluate what will be committed first: this issue or #2968766: Add Drush commands for getting details of available configurations.
One of them will need a re-roll anyway.

damienmckenna’s picture

No worries, Paul, your contributions are appreciated.

I'll review this soon.

larisse’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new132.76 KB

Hi!
I tested this patch and I received a error message when I tried to do my backup and not had a Settings Profile configured. After I add a Settings Profile, the drush command works in all backup options.

damienmckenna’s picture

Thanks for testing the patch, larisse. Out of interest, what version of Drush are you using?

PaulOCS: What version of Drush did you write the code against? v9? v10?

paulocs’s picture

Drush 10

larisse’s picture

Hi @Damien! I'm using Drush 10.5.0 version.

paulocs’s picture

Is it okay with Drush 10 version?

If yes, I can fix the problem reported in #5.

paulocs’s picture

Status: Needs work » Needs review
StatusFileSize
new2.25 KB
larisse’s picture

Status: Needs review » Reviewed & tested by the community

Patch #10 looks good to me.
I can make a backup when I had or when I not had a Settings Profile configured.

grevil’s picture

@paulocs thanks for your time implementing this! I can confirm, patch #10 is looking great!

Just one minor suggestion. Would it be possible to add flags to the command? I am currently working on an automatic setup for a Drupal dev environment, and I would love to use backup_migrate on startup via script!

Maybe something like this:

drush backup_migrate:quick_backup --default_db --destination=private_files

anybody’s picture

+1 for #12! Good point. I'd even go one step further and would suggest running the backup to default destination with default settings like it was possible in Drupal 7 with one command: drush bb.
There's a connection to this issue: #3124408: [PP-1] Admin Menu Shortcut / Shortcut Block ("One Click Backup") both would benefit from being able to define a default backup destination! :)

I guess a maintainer should decide. What do you think @DamienMcKenna?

My vote would go for committing this to have ANY solution and then create a follow-up for these two additions?

Edit / Update: I created a follow-up feature request to be able to define defaults: #3251217: Allow to define one backup profile, source and target as default for quick backup via UI and Drush so I'd vote for a "drush bb" command like in Drupal 7 doing a quick backup, drush bb -i(=interactive) with the current behaviour and alternatively parameters to override default values. That would be perfect in my eyes. :)

paulocs’s picture

yes i can do what Grevil suggested. Should we do it in this issue or in a followup issue?

anybody’s picture

Status: Reviewed & tested by the community » Needs work

Thank you @paulocs,

as written in #13 I'd suggest to create the command here, but perhaps postpone this on #3251217: Allow to define one backup profile, source and target as default for quick backup via UI and Drush first?

... so I'd vote for a "drush bb" command like in Drupal 7 doing a quick backup, drush bb -i(=interactive) with the current behaviour and alternatively parameters to override default values.

To better explain it:

What I'd suggest to make things as simple, understandable and flexible as possible:
- Create a drush bam-backup (shortcutdrush bb) command like it existed in Drupal 7. It should require no parameters and use the defaults for profile, source and target.
- Therefor fix #3251217: Allow to define one backup profile, source and target as default for quick backup via UI and Drush to be able to define defaults
- Allow to override the defaults, if parameter is given.
- Bonus: Add a "-i" (interactive) parameter to let the command which asks for the parameters instead providing the possible options like you did in your patch perfectly!

I guess that would be most future-proof.

Perhaps until the other issue is fixed, we could require the parameters?

Here you can find the D7 implementation we should comply with: https://drushcommands.com/drush-7x/backup-migrate/bam-backup/

This solution is simple to run and also flexible as it offers the option to use it in scripts or manually and Drupal 7 users don't have to use a different command, which worked perfectly.

paulocs’s picture

Assigned: Unassigned » paulocs
paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.14 KB

I created a new patch with the flags suggested in #12.

So now you can run drush bb in an interactive way or not.

grevil’s picture

Status: Needs review » Reviewed & tested by the community

@paulocs this works perfectly, thank you for the quick implementation!

Just one more tiny addition, maybe we could add a --replace flag, for cases, where we would like to replace the last backup with a new backup, instead of always adding a backup.

anybody’s picture

Thank you for the review @Grevil!

Just one more tiny addition, maybe we could add a --replace flag, for cases, where we would like to replace the last backup with a new backup, instead of always adding a backup.

I wouldn't say it doesn't make sense, especially in development environments, but it's very untypical. We should discuss here if it's worth a separate issue, but shouldn't be added here, I think!

I tend to say no from my experience ... but let's hear further voices ;)

damienmckenna’s picture

Huge thanks to everyone for working on this.

I agree with @Anybody, any other changes should be discussed in separate issues.

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks everyone!

damienmckenna’s picture

Version: 5.0.x-dev » 5.1.x-dev
anybody’s picture

Sooo great news, thank you very much @Damien! :) Happy to be able to use this again!!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

anybody’s picture

@DamienMcKenna 5.1.x still seems to be far away? Would it be possible to cherry-pick this into 5.0.x perhaps? Two years later I'm still waiting to be able to use this functionality :(

ericdsd’s picture

Hi i do agree with Anybody, should we reopen this issue or create a new one to backport this to 5.0.