function backup_migrate_schedule::cron

cis7 schedules.inc backup_migrate_schedule::cron()
cle7 schedules.inc backup_migrate_schedule::cron()
elmsmedia7 schedules.inc backup_migrate_schedule::cron()
icor7 schedules.inc backup_migrate_schedule::cron()
meedjum_blog7 schedules.inc backup_migrate_schedule::cron()
mooc7 schedules.inc backup_migrate_schedule::cron()

Perform the cron action. Run the backup if enough time has elapsed.

File

sites/all/modules/ulmus/backup_migrate/includes/schedules.inc, line 331
All of the schedule handling code needed for Backup and Migrate.

Class

backup_migrate_schedule
A schedule class for crud operations.

Code

function cron() {
  $now = time();

  // Add a small negative buffer (1% of the entire period) to the time to account for slight difference in cron run length.
  $wait_time = $this->period - ($this->period * variable_get('backup_migrate_schedule_buffer', 0.01));

  if ($this->is_enabled() && ($now - $this->get('last_run')) >= $wait_time) {
    if ($settings = $this->get_profile()) {
      $settings->destination_id = $this->destination_id;
      $settings->source_id = $this->source_id;
      $this->update_last_run($now);
      backup_migrate_perform_backup($settings);
      $this->remove_expired_backups();
    }
    else {
      backup_migrate_backup_fail("Schedule '%schedule' could not be run because requires a profile which is missing.", array('%schedule' => $schedule->get_name()), $settings);
    }
  }
}