You are here

public function backup_migrate_schedule::cron in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 includes/schedules.inc \backup_migrate_schedule::cron()
  2. 8.3 includes/schedules.inc \backup_migrate_schedule::cron()
  3. 6.3 includes/schedules.inc \backup_migrate_schedule::cron()
  4. 6.2 includes/schedules.inc \backup_migrate_schedule::cron()
  5. 7.2 includes/schedules.inc \backup_migrate_schedule::cron()

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

File

includes/schedules.inc, line 670
All of the schedule handling code needed for Backup and Migrate.

Class

backup_migrate_schedule
A schedule class for crud operations.

Code

public 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', BACKUP_MIGRATE_SCHEDULE_BUFFER);
  $cron = $this
    ->get('cron');
  if ($cron == BACKUP_MIGRATE_CRON_BUILTIN && $this
    ->is_enabled() && $now - $this
    ->get('last_run') >= $wait_time) {
    $this
      ->run();
  }
}