WordPress.org

Make WordPress Core

Ticket #11640: 11640.diff

File 11640.diff, 1.6 KB (added by dd32, 8 years ago)
  • wp-admin/includes/plugin-install.php

     
    3838        $res = apply_filters('plugins_api', false, $action, $args); //NOTE: Allows a plugin to completely override the builtin WordPress.org API.
    3939
    4040        if ( ! $res ) {
    41                 $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
     41                $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );
    4242                if ( is_wp_error($request) ) {
    4343                        $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
    4444                } else {
     
    197197function install_popular($page = 1) {
    198198        $args = array('browse' => 'popular', 'page' => $page);
    199199        $api = plugins_api('query_plugins', $args);
     200        if ( is_wp_error($api) )
     201                wp_die($api);
    200202        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
    201203}
    202204
     
    248250function install_updated($page = 1) {
    249251        $args = array('browse' => 'updated', 'page' => $page);
    250252        $api = plugins_api('query_plugins', $args);
     253        if ( is_wp_error($api) )
     254                wp_die($api);
    251255        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
    252256}
    253257