You are here

function backup_migrate_cronapi in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.3 backup_migrate.module \backup_migrate_cronapi()
  2. 6.3 backup_migrate.module \backup_migrate_cronapi()

Implements hook_cronapi().

File

./backup_migrate.module, line 337
Backup and restore databases for Drupal.

Code

function backup_migrate_cronapi($op, $job = NULL) {

  // Optionally disable hook_cron().
  if (variable_get('backup_migrate_disable_cron', BACKUP_MIGRATE_DISABLE_CRON)) {
    if (variable_get('backup_migrate_verbose')) {
      watchdog('backup_migrate', 'Cron disabled.');
    }
    return;
  }
  require_once dirname(__FILE__) . '/includes/schedules.inc';
  $items = array();
  foreach (backup_migrate_get_schedules() as $schedule) {
    if ($schedule
      ->get('cron') == BACKUP_MIGRATE_CRON_ELYSIA) {
      $id = $schedule
        ->get('id');
      $items['backup_migrate_' . $id] = array(
        'description' => t("Run the Backup and Migrate '!name' schedule", array(
          '!name' => $schedule
            ->get('name'),
        )),
        'rule' => $schedule
          ->get('cron_schedule'),
        'callback' => 'backup_migrate_schedule_run',
        'arguments' => array(
          $id,
        ),
        'file' => 'includes/schedules.inc',
      );
    }
  }
  return $items;
}