Ejemplo n.º 1
0
/**
 * Cancels a running backup then redirect back to the backups page
 */
function hmbkp_request_cancel_backup()
{
    check_admin_referer('hmbkp_request_cancel_backup', 'hmbkp-request_cancel_backup_nonce');
    $schedule = new HMBKP_Scheduled_Backup(sanitize_text_field(urldecode($_GET['hmbkp_schedule_id'])));
    // Delete the running backup
    if ($schedule->get_running_backup_filename() && file_exists(trailingslashit(hmbkp_path()) . $schedule->get_running_backup_filename())) {
        unlink(trailingslashit(hmbkp_path()) . $schedule->get_running_backup_filename());
    }
    if ($schedule->get_schedule_running_path() && file_exists($schedule->get_schedule_running_path())) {
        unlink($schedule->get_schedule_running_path());
    }
    HMBKP_Path::get_instance()->cleanup();
    wp_safe_redirect(hmbkp_get_settings_url(), 303);
    die;
}
Ejemplo n.º 2
0
/**
 * Cancels a running backup then redirect
 * back to the backups page
 */
function hmbkp_request_cancel_backup()
{
    if (!isset($_GET['action']) || $_GET['action'] !== 'hmbkp_cancel') {
        return;
    }
    $schedule = new HMBKP_Scheduled_Backup(sanitize_text_field(urldecode($_GET['hmbkp_schedule_id'])));
    // Delete the running backup
    if ($schedule->get_running_backup_filename() && file_exists(trailingslashit(hmbkp_path()) . $schedule->get_running_backup_filename())) {
        unlink(trailingslashit(hmbkp_path()) . $schedule->get_running_backup_filename());
    }
    hmbkp_cleanup();
    wp_redirect(remove_query_arg(array('action')), 303);
    die;
}