BSF_Rollback_Version_Manager::bsf_download_rollback_version()
Download Product Version.
Description
Source
File: admin/bsf-core/class-bsf-rollback-version-manager.php
public function bsf_download_rollback_version() { if ( ! current_user_can( 'update_plugins' ) ) { return false; } if ( empty( $_GET['version_no'] ) || empty( $_GET['product_id'] ) || ! isset( $_GET['action'] ) ) { return false; } check_admin_referer( 'bsf_rollback' ); $bsf_update_manager = new BSF_Update_Manager(); $version_no = sanitize_text_field( $_GET['version_no'] ); $product_id = sanitize_text_field( $_GET['product_id'] ); $product_details = get_brainstorm_product( $product_id ); $plugin_slug = ! empty( $product_details['slug'] ) ? $product_details['slug'] : ''; $plugin_name = ! empty( $product_details['template'] ) ? $product_details['template'] : ''; $bundled_plugin_name = ! empty( $product_details['init'] ) ? $product_details['init'] : ''; $purchase_key = $bsf_update_manager->get_purchse_key( $product_id ); $product_title = ! empty( $product_details['name'] ) ? $product_details['name'] : ''; $plugin_name = ! empty( $plugin_name ) ? $plugin_name : $bundled_plugin_name; $download_params = array( 'version_no' => $version_no, 'purchase_key' => $purchase_key, 'site_url' => get_site_url(), ); $download_url = bsf_get_api_site( false, true ) . 'download/' . $product_id . '?' . http_build_query( $download_params ); $rollback = new BSF_Rollback_Version( array( 'version' => $version_no, 'plugin_name' => $plugin_name, 'plugin_slug' => $plugin_slug, 'package_url' => $download_url, 'product_title' => $product_title, 'product_id' => $product_id, ) ); $rollback->run(); // Delete product versions transient data after update. bsf_clear_versions_cache( $product_id ); wp_die(); }
Expand full source code Collapse full source code View on Trac