You are here

function backup_migrate_drush_backup in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.2 includes/backup_migrate.drush.inc \backup_migrate_drush_backup()
  2. 8.3 includes/backup_migrate.drush.inc \backup_migrate_drush_backup()
  3. 6.2 includes/backup_migrate.drush.inc \backup_migrate_drush_backup()
  4. 7.3 includes/backup_migrate.drush.inc \backup_migrate_drush_backup()
  5. 7.2 includes/backup_migrate.drush.inc \backup_migrate_drush_backup()

Backup the default database.

1 string reference to 'backup_migrate_drush_backup'
backup_migrate_drush_command in includes/backup_migrate.drush.inc
Implementation of hook_drush_command().

File

includes/backup_migrate.drush.inc, line 84
Drush commands for backup and migrate.

Code

function backup_migrate_drush_backup($source_id = 'db', $destination_id = 'manual', $profile_id = 'default') {
  backup_migrate_include('profiles', 'destinations');

  // Set the message mode to logging.
  _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 (!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;
  }
  $settings = backup_migrate_get_profile($profile_id);
  if (!$settings) {
    _backup_migrate_message("Could not find the profile '@profile'. Try using 'drush bam-profiles' to get a list of available profiles.", array(
      '@profile' => $profile_id,
    ), 'error');
    return;
  }
  _backup_migrate_message('Starting backup...');
  $settings->destination_id = $destination_id;
  $settings->source_id = $source_id;
  backup_migrate_perform_backup($settings);
}