bsf_get_remote_version( array $product_list, array $products )

Get remote version for product


Description


Parameters

$product_list

(array) (Required) products data.

$products

(array) (Required) products data (deprecated).


Return

(array)


Source

File: admin/bsf-core/auto-update/updater.php

	function bsf_get_remote_version( $product_list, $products ) {
		global $ultimate_referer;

		$path = bsf_get_api_url() . '?referer=' . $ultimate_referer;

		$data = array(
			'action' => 'bsf_get_product_versions',
			'ids' => $products,
			'products' => $product_list,
			'site_url' => get_site_url(),
			'php_version' => bsf_get_php_version(),
			'wp_version' => get_bloginfo( 'version' ),
			'locale' => get_locale(),
			'bsf_core_version' => BSF_UPDATER_VERSION,
			'active_theme' => get_template(),
			'active_stylesheet' => get_stylesheet(),
			'php_max_input_vars' => ini_get( 'max_input_vars' ), // phpcs:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
			'php_post_max_size' => ini_get( 'post_max_size' ),
			'php_max_execution_time' => ini_get( 'max_execution_time' ),
			'php_memory_limit' => ini_get( 'memory_limit' ),
		);

		$request = wp_remote_post(
			$path,
			array(
				'body'    => $data,
				'timeout' => '10',
			)
		);

		// Request http URL if the https version fails.
		if ( is_wp_error( $request ) && 200 !== wp_remote_retrieve_response_code( $request ) ) {
			$path    = bsf_get_api_url( true ) . '?referer=' . $ultimate_referer;
			$request = wp_remote_post(
				$path,
				array(
					'body'    => $data,
					'timeout' => '8',
				)
			);
		}

		if ( ! is_wp_error( $request ) || 200 === wp_remote_retrieve_response_code( $request ) ) {
			$result = json_decode( wp_remote_retrieve_body( $request ) );
			if ( ! empty( $result ) ) {
				if ( empty( $result->error ) ) {
					return $result->updated_versions;
				} else {
					return $result->error;
				}
			}
		}
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.