X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..53a5df18dd17a11c18781e78349feb3e139096b4:/wp-admin/includes/plugin-install.php diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 7f1e0f2c..58a9e9ba 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -60,17 +60,23 @@ function plugins_api($action, $args = null) { $res = apply_filters( 'plugins_api', false, $action, $args ); if ( false === $res ) { - $url = 'http://api.wordpress.org/plugins/info/1.0/'; - if ( wp_http_supports( array( 'ssl' ) ) ) + $url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/'; + if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) $url = set_url_scheme( $url, 'https' ); - $request = wp_remote_post( $url, array( + $args = array( 'timeout' => 15, 'body' => array( 'action' => $action, 'request' => serialize( $args ) ) - ) ); + ); + $request = wp_remote_post( $url, $args ); + + if ( $ssl && is_wp_error( $request ) ) { + trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + $request = wp_remote_post( $http_url, $args ); + } if ( is_wp_error($request) ) { $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), $request->get_error_message() );