/** * Delete the backup and then redirect back to the backups page */ function hmbkp_request_delete_backup() { check_admin_referer('hmbkp_delete_backup', 'hmbkp_delete_backup_nonce'); $schedule = new HM\BackUpWordPress\Scheduled_Backup(sanitize_text_field(urldecode($_GET['hmbkp_schedule_id']))); $deleted = $schedule->delete_backup(sanitize_text_field(base64_decode($_GET['hmbkp_backup_archive']))); if (is_wp_error($deleted)) { wp_die($deleted->get_error_message()); } wp_safe_redirect(hmbkp_get_settings_url(), 303); die; }
function hmbkp_request_delete_backup() { if (!isset($_POST['hmbkp_backuparchive']) || empty($_POST['hmbkp_backuparchive'])) { return array('error' => __("Error data.", 'mainwp-child')); } $schedule_id = $this->check_schedule(); $schedule = new HM\BackUpWordPress\Scheduled_Backup(sanitize_text_field(urldecode($schedule_id))); $deleted = $schedule->delete_backup(sanitize_text_field(base64_decode($_POST['hmbkp_backuparchive']))); if (is_wp_error($deleted)) { return array('error' => $deleted->get_error_message()); } return array('result' => 'SUCCESS', 'b' => $this->get_backupslist_html($schedule), 'count' => count($schedule->get_backups()), 'file_size_text' => $this->hmbkp_get_site_size_text($schedule), 'scheduleStatus' => $schedule->get_status()); }