You are here

function backup_migrate_backup_migrate_schedules in Backup and Migrate 8.3

Same name and namespace in other branches
  1. 5.2 includes/schedules.inc \backup_migrate_backup_migrate_schedules()
  2. 6.3 backup_migrate.module \backup_migrate_backup_migrate_schedules()
  3. 7.3 backup_migrate.module \backup_migrate_backup_migrate_schedules()
  4. 7.2 backup_migrate.module \backup_migrate_backup_migrate_schedules()

Implements hook_backup_migrate_destinations().

File

./backup_migrate.module, line 411
Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (e.g. cache_*)

Code

function backup_migrate_backup_migrate_schedules() {
  backup_migrate_include('sources');
  $schedules = array();

  // Declare a default backup for each source that can be enabled.
  // @TODO: This makes setting up scheduled easier, but only when combined with the now disabled quick-schedule feature.
  // $sources = backup_migrate_get_sources();
  // foreach ($sources as $id => $source) {
  //   $schedule = array(
  //     'schedule_id' => $id,
  //     'name' => $source->get('name'),
  //     'source_id' => $id,
  //     'destination_id' => 'scheduled',
  //     'profile_id' => 'default',
  //     'period' => variable_get('backup_migrate_default_schedule', 60*60),
  //     'keep' => BACKUP_MIGRATE_SMART_DELETE,
  //     'enabled' => FALSE,
  //   );
  //   $schedules[$id] = backup_migrate_crud_create_item('schedule', $schedule);
  // }
  if (variable_get('nodesquirrel_secret_key', FALSE) != FALSE) {
    $schedule = array(
      'machine_name' => 'nodesquirrel',
      'name' => 'NodeSquirrel',
      'source_id' => variable_get('nodesquirrel_schedule_source_id', 'db'),
      'destination_id' => 'nodesquirrel',
      'profile_id' => 'default',
      'period' => variable_get('nodesquirrel_schedule', 60 * 60 * 24),
      'enabled' => variable_get('nodesquirrel_schedule_enabled', TRUE) && variable_get('nodesquirrel_secret_key', FALSE) != FALSE,
    );
    $schedules['nodesquirrel'] = backup_migrate_crud_create_item('schedule', $schedule);
  }
  return $schedules;
}