function backup_migrate_drush_restore in Backup and Migrate 7.2
Same name and namespace in other branches
- 8.2 includes/backup_migrate.drush.inc \backup_migrate_drush_restore()
- 8.3 includes/backup_migrate.drush.inc \backup_migrate_drush_restore()
- 6.3 includes/backup_migrate.drush.inc \backup_migrate_drush_restore()
- 6.2 includes/backup_migrate.drush.inc \backup_migrate_drush_restore()
- 7.3 includes/backup_migrate.drush.inc \backup_migrate_drush_restore()
Restore to the default database.
1 string reference to 'backup_migrate_drush_restore'
- backup_migrate_drush_command in includes/
backup_migrate.drush.inc - Implementation of hook_drush_command().
File
- includes/
backup_migrate.drush.inc, line 113 - Drush commands for backup and migrate.
Code
function backup_migrate_drush_restore($source_id = '', $destination_id = '', $file_id = '') {
drush_print(dt('Restoring will delete some or all of your data and cannot be undone. ALWAYS TEST YOUR BACKUPS ON A NON-PRODUCTION SERVER!'));
if (!drush_confirm(dt('Are you sure you want to restore the database?'))) {
return drush_user_abort();
}
backup_migrate_include('profiles', 'destinations');
// Set the message mode to drush output.
_backup_migrate_message_callback('_backup_migrate_message_drush');
if (!backup_migrate_get_destination($source_id)) {
_backup_migrate_message("Could not find the source '@source'. Try using 'drush bam-sources' to get a list of available sources or use 'db' to backup the Drupal database.", array(
'@source' => $source_id,
), 'error');
return;
}
if (!($destination = backup_migrate_get_destination($destination_id))) {
_backup_migrate_message("Could not find the destination '@destination'. Try using 'drush bam-destinations' to get a list of available destinations.", array(
'@destination' => $destination_id,
), 'error');
return;
}
if (!$file_id || !($file = backup_migrate_destination_get_file($destination_id, $file_id))) {
_backup_migrate_message("Could not find the file '@file'. Try using 'drush bam-backups @destination' to get a list of available backup files in this destination destinations.", array(
'@destination' => $destination_id,
'@file' => $file_id,
), 'error');
return;
}
_backup_migrate_message('Starting restore...');
$settings = array(
'source_id' => $source_id,
);
backup_migrate_perform_restore($destination_id, $file_id, $settings);
}