/** * Run the backup * */ public function run() { // Don't run if this schedule is already running if ($this->get_running_backup_filename()) { return; } // Mark the backup as started $this->set_status(__('Starting Backup', 'backupwordpress')); // Delete old backups now in-case we fatal error during the backup process $this->delete_old_backups(); if ($this->get_backups()) { // If we already have a previous backup then pass it in so it can be re-used list($existing_backup) = array_values($this->get_backups()); if ($existing_backup && file_exists($existing_backup)) { $this->backup->set_existing_archive_filepath($existing_backup); } } $this->backup->backup(); // Delete the backup running file if (file_exists($this->get_schedule_running_path())) { unlink($this->get_schedule_running_path()); } // Delete old backups again $this->delete_old_backups(); }