You are here

function backup_migrate_cron in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.4 backup_migrate.module \backup_migrate_cron()
  2. 8.2 backup_migrate.module \backup_migrate_cron()
  3. 8.3 backup_migrate.module \backup_migrate_cron()
  4. 5.2 backup_migrate.module \backup_migrate_cron()
  5. 5 backup_migrate.module \backup_migrate_cron()
  6. 6.3 backup_migrate.module \backup_migrate_cron()
  7. 6 backup_migrate.module \backup_migrate_cron()
  8. 6.2 backup_migrate.module \backup_migrate_cron()
  9. 7.2 backup_migrate.module \backup_migrate_cron()
  10. 5.0.x backup_migrate.module \backup_migrate_cron()

Implements hook_cron().

File

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

Code

function backup_migrate_cron() {

  // 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/files.inc';
  require_once dirname(__FILE__) . '/includes/schedules.inc';
  if (variable_get('backup_migrate_verbose')) {
    watchdog('backup_migrate', 'Cron starting.');
  }

  // Takes care of scheduled backups and deletes abandoned temp files.
  // Set the message mode to logging.
  _backup_migrate_message_callback('_backup_migrate_message_log');

  // Clean up any previous abandoned tmp files before we attempt to back up.
  if (variable_get('backup_migrate_verbose')) {
    watchdog('backup_migrate', 'Deleting temp files.');
  }
  _backup_migrate_temp_files_delete();
  if (variable_get('backup_migrate_verbose')) {
    watchdog('backup_migrate', 'Processing schedule(s) backups.');
  }
  backup_migrate_schedules_cron();

  // Clean up any temporary files from this run.
  if (variable_get('backup_migrate_verbose')) {
    watchdog('backup_migrate', 'Deleting temp files.');
  }
  _backup_migrate_temp_files_delete();
  if (variable_get('backup_migrate_verbose')) {
    watchdog('backup_migrate', 'Cron finished.');
  }
}