You are here

function backup_migrate_cron in Backup and Migrate 5.2

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 backup_migrate.module \backup_migrate_cron()
  5. 6.3 backup_migrate.module \backup_migrate_cron()
  6. 6 backup_migrate.module \backup_migrate_cron()
  7. 6.2 backup_migrate.module \backup_migrate_cron()
  8. 7.3 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()

Implementation of hook_cron().

Takes care of scheduled backups and deletes abandoned temp files.

File

./backup_migrate.module, line 269
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_cron() {
  require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/schedules.inc';
  backup_migrate_schedules_run();

  // Delete temp files abandoned for 6 or more hours.
  foreach (file_scan_directory(file_directory_temp(), 'backup_migrate_*', array(
    '.',
    '..',
  ), 0, FALSE) as $file) {
    if (filectime($file->filename) < time() - 21600) {
      unlink($file->filename);
    }
  }
}