I'm trying to create a custom module that will overwrite my testing site with a copy of my live site (I can't use SSH and I can't install my own PEAR modules, so Drush is a no-go).
I've been using PHP execute() commands to manipulate the file system and dump the database, but I'm getting errors on the testing site when importing the SQL dump, and I usually have to resort instead to the Backup and Migrate module, using a profile that copies my main database over to my testing database.
Now I'm wondering, is there any way I can hook into this and execute it as part of the chain of commands in my custom module? The goal is to turn the process of migrating to the testing site into a one-click (followed by a lot of grinding) process. But since Backup and Migrate doesn't apparently expose any API or hooks, or even the machine names of its profiles and destinations, how could I execute a backup command with a specific preset from a different module?
Say, for instance, I want a PHP command that will tell Backup and Migrate to backup database
live_db to destination
test_db, both of which are already recorded as mysql://[db_name] in the B&M settings.