You are here

function backup_migrate_drush_command in Backup and Migrate 8.2

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

Implementation of hook_drush_command().

File

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

Code

function backup_migrate_drush_command() {
  $items['bam-backup'] = array(
    'callback' => 'backup_migrate_drush_backup',
    'description' => dt('Backup the site\'s database with Backup and Migrate.'),
    'aliases' => array(
      'bb',
    ),
    'examples' => array(
      'drush bam-backup' => 'Backup the default databse to the manual backup directory using the default settings.',
      'drush bam-backup db scheduled mysettings' => 'Backup the database to the scheduled directory using a settings profile called "mysettings"',
      'drush bam-backup files' => 'Backup the files directory to the manual directory using the default settings. The Backup and Migrate Files module is required for files backups.',
    ),
    'arguments' => array(
      'source' => "Optional. The id of the source (usually a database) to backup. Use 'drush bam-sources' to get a list of sources. Defaults to 'db'",
      'destination' => "Optional. The id of destination to send the backup file to. Use 'drush bam-destinations' to get a list of destinations. Defaults to 'manual'",
      'profile' => "Optional. The id of a settings profile to use. Use 'drush bam-profiles' to get a list of available profiles. Defaults to 'default'",
    ),
  );
  $items['bam-restore'] = array(
    'callback' => 'backup_migrate_drush_restore',
    'description' => dt('Restore the site\'s database with Backup and Migrate.'),
    'arguments' => array(
      'source' => "Required. The id of the source (usually a database) to restore the backup to. Use 'drush bam-sources' to get a list of sources. Defaults to 'db'",
      'destination' => "Required. The id of destination to send the backup file to. Use 'drush bam-destinations' to get a list of destinations. Defaults to 'manual'",
      'backup id' => "Required. The id of a backup file restore. Use 'drush bam-backups' to get a list of available backup files.",
    ),
    'options' => array(
      'yes' => 'Skip confirmation',
    ),
  );
  $items['bam-destinations'] = array(
    'callback' => 'backup_migrate_drush_destinations',
    'description' => dt('Get a list of available destinations.'),
  );
  $items['bam-sources'] = array(
    'callback' => 'backup_migrate_drush_sources',
    'description' => dt('Get a list of available sources.'),
  );
  $items['bam-profiles'] = array(
    'callback' => 'backup_migrate_drush_profiles',
    'description' => dt('Get a list of available settings profiles.'),
  );
  $items['bam-backups'] = array(
    'callback' => 'backup_migrate_drush_destination_files',
    'description' => dt('Get a list of previously created backup files.'),
    'arguments' => array(
      'destination' => "Required. The id of destination to list backups from. Use 'drush bam-destinations' to get a list of destinations.",
    ),
  );
  return $items;
}