From 926e4da4634a4b888b0b3f544e3ae9c61c69f20a Mon Sep 17 00:00:00 2001 From: meteor Date: Mon, 27 Nov 2023 17:52:11 +0400 Subject: [PATCH] PLUGINS-6825 --- lib/ecwid_platform.php | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/lib/ecwid_platform.php b/lib/ecwid_platform.php index 118244db..56bb6724 100644 --- a/lib/ecwid_platform.php +++ b/lib/ecwid_platform.php @@ -5,8 +5,6 @@ class EcwidPlatform { - protected static $http_use_streams = false; - protected static $crypt = null; protected static $ecwid_plugin_data = null; @@ -257,10 +255,6 @@ public static function fetch_url( $url, $options = array() ) { ); } - if ( get_option( 'ecwid_http_use_stream', false ) ) { - self::$http_use_streams = true; - } - $default_timeout = 10; $result = wp_remote_get( $url, @@ -273,7 +267,6 @@ public static function fetch_url( $url, $options = array() ) { ); if ( wp_remote_retrieve_response_code( $result ) == '429' ) { - $retry_after = intval( wp_remote_retrieve_header( $result, 'retry-after' ) ); if ( $retry_after > 0 ) { @@ -281,10 +274,6 @@ public static function fetch_url( $url, $options = array() ) { } } - if ( get_option( 'ecwid_http_use_stream', false ) ) { - self::$http_use_streams = false; - } - $return = array( 'code' => '', 'data' => '', @@ -302,7 +291,6 @@ public static function fetch_url( $url, $options = array() ) { 'data' => $result['body'], ); } elseif ( is_object( $result ) ) { - $return = array( 'code' => $result->get_error_code(), 'data' => $result->get_error_data(), @@ -332,19 +320,7 @@ public static function http_post_request( $url, $data = array(), $params = array $args['body'] = $data; - if ( get_option( 'ecwid_http_use_stream', false ) !== true ) { - $result = wp_remote_post( $url, $args ); - } - - if ( ! is_array( $result ) ) { - self::$http_use_streams = true; - $result = wp_remote_post( $url, $args ); - self::$http_use_streams = false; - - if ( is_array( $result ) ) { - update_option( 'ecwid_http_use_stream', true ); - } - } + $result = wp_remote_post( $url, $args ); return $result; } @@ -392,14 +368,6 @@ public static function reset( $name ) { update_option( self::OPTION_ECWID_PLUGIN_DATA, self::$ecwid_plugin_data ); } - public static function http_api_transports( $transports ) { - if ( self::$http_use_streams ) { - return array( 'streams' ); - } - - return $transports; - } - public static function store_in_products_cache( $url, $data ) { self::store_in_cache( $url, 'products', $data, WEEK_IN_SECONDS ); } @@ -609,5 +577,3 @@ public static function clear_all_transients() { do_action( 'ecwid_clean_external_cache' ); } } - -add_filter( 'http_api_transports', array( 'EcwidPlatform', 'http_api_transports' ) );