/** * Run the backup * */ public function run() { // Don't run if this schedule is already running if ($this->status->is_started()) { return; } // Setup our Site Backup Object $backup = new Backup($this->get_backup_filename(), $this->get_database_dump_filename()); $backup->set_type($this->get_type()); $backup->set_excludes($this->get_excludes()); $backup->set_status($this->status); $this->do_action('hmbkp_backup_started', $backup); $this->status->start($this->get_backup_filename(), __('Starting backup...', 'backupwordpress')); $this->status->set_status(__('Deleting old backups...', 'backupwordpress')); // Delete old backups now in-case we fatal error during the backup process $this->delete_old_backups(); $backup->run(); $errors = array_merge($backup->errors, $backup->warnings); $notices = array(); foreach ($errors as $key => $error) { $key = str_replace(array(__NAMESPACE__ . '\\', '_File_Backup_Engine', '_Database_Backup_Engine'), array('', '', ''), $key); $notices[] = $key . ': ' . implode(', ', $error); } Notices::get_instance()->set_notices('backup_errors', $notices); $this->status->set_status(__('Deleting old backups...', 'backupwordpress')); // Delete old backups again $this->delete_old_backups(); $this->do_action('hmbkp_backup_complete', $backup); $this->status->finish(); $this->update_average_schedule_run_time($this->status->get_start_time(), time()); }