Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm liking the profiles feature in 2.x. For those of us using Backup and Migrate on multiple sites a killer feature would be the ability to import and export these profiles so that one doesn't have to manually configure every site's backup routine.
Comments
Comment #1
ronan CreditAttribution: ronan commentedGood idea, I'll make it a todo. Version 1.x stored all settings in the variables table, so you could configure it in settings.php but that's no longer possible as the module's gotten quite a bit more complicated.
I'd like to see some sort of file based configuration rather than importing and exporting settings since then you'd be able to version control your settings, and they'd be immune to database changes (helpful for this particular module).
For exporting and importing settings, you could use the module itself to export only the tables starting with 'backup_migrate_'.
R
Comment #2
rickvug CreditAttribution: rickvug commentedI agree that adding the ability to store configuration in code is the way to go (issue re-titled accordingly). Views is an excellent example of how configuration can be set in code and then overridden as needed with a database version. It also has export capabilities. Some of those features are "nice to haves" but its good to have something to shoot for. If you need a someone to test a dev release with this functionality just let me know. :)
Comment #3
ronan CreditAttribution: ronan commentedViews is what I had in mind too. I like how it works and would probably model my solution on that.
If you're not afraid of a little PHP, you can get that effect right now by creating a custom module and implementing HOOK_backup_migrate_profiles. It takes no arguments and should return an array of profiles. With no export feature you'll have to build the profiles by hand, but here's an example to get you started:
Code not tested, so it probably has some stupid parse error in it.
There are similar hooks for schedules and destinations.
I hope this helps tide you over until I'm able to get to import/export.
Ronan
Comment #4
ronan CreditAttribution: ronan commentedThe latest dev has 'exportables' capability built in. To export a profile, schedule or destination, install the chaos tools module (http://drupal.org/project/ctools) and export links will appear in the listings for those items. You only need ctools to export and can turn it off when you are happy with what you've exported.
To expose the exported items to backup and migrate you can then either use a custom module and the method described in http://drupal.org/node/373786#comment-1260099 above or you can add them to your $conf variable in settings.php as shown below:
If you want the items to depend on each other, be sure to export them one at a time, or change the ids by hand.
Let me know if this works and if you have any issues with it. I may change the formats slightly and if I do I'll update this thread so you know how to change your defaults.
Thanks
Ronan
Comment #5
ronan CreditAttribution: ronan commentedComment #7
rickvug CreditAttribution: rickvug commentedI forgot to say thank you for this. Thanks! Also, using cTools for this 9 months ago seems to have been solid foresight with Features module integration.
Comment #8
Tor Arne Thune CreditAttribution: Tor Arne Thune commentedInside settings.php this works great, but I also tried it in a custom module, and I got these errors when I ran
drush bam-profiles
:Here is the
mymodule_backup_migrate_profiles
inmymodule.install
:I also tried with the code from #3 and got the same errors:
Comment #9
Tor Arne Thune CreditAttribution: Tor Arne Thune commentedComment #10
jdleonardsub
Comment #11
TravisCarden CreditAttribution: TravisCarden commentedSince the module no longer uses simple Drupal variables, I'm closing this in favor of #1001654: Make backup profiles and schedules Features exportable.