You are here

function backup_migrate_drush_schedule in Backup and Migrate 7.3

Backup using schedule.

1 string reference to 'backup_migrate_drush_schedule'
backup_migrate_drush_command in includes/backup_migrate.drush.inc
Implements hook_drush_command().

File

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

Code

function backup_migrate_drush_schedule($schedule_id = '') {
  require_once dirname(__FILE__) . '/schedules.inc';

  // Set the message mode to drush output.
  _backup_migrate_message_callback('_backup_migrate_message_drush');
  if (!($schedule = backup_migrate_get_schedule($schedule_id))) {
    _backup_migrate_message("Could not find the schedule '@schedule'. Try using 'drush bam-schedules' to get a list of available schedules.", array(
      '@schedule' => $schedule_id,
    ), 'error');
    return;
  }
  if (!$schedule->enabled) {
    _backup_migrate_message("Nothing to do, the schedule '@schedule' is disabled.", array(
      '@schedule' => $schedule_id,
    ), 'warning');
    return;
  }
  _backup_migrate_message("Starting schedule '{$schedule_id}'...");
  backup_migrate_schedule_run($schedule_id);
}