Make WordPress Core

Ticket #5037: 5037.002.diff

File 5037.002.diff, 1.7 KB (added by markjaquith, 17 years ago)
  • wp-includes/update.php

     
    33// A simple set of functions to check our version 1.0 update service
    44
    55function wp_version_check() {
    6         if ( strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') )
     6        if ( !function_exists('fsockopen') || strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') )
    77                return;
    88
    99        global $wp_version;
     
    3030        $http_request .= "\r\n";
    3131
    3232        $response = '';
    33         if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) ) {
     33        if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) && is_resource($fs) ) {
    3434                fwrite( $fs, $http_request );
    3535                while ( !feof( $fs ) )
    3636                        $response .= fgets( $fs, 1160 ); // One TCP-IP packet
  • wp-admin/includes/update.php

     
    4242
    4343function wp_update_plugins() {
    4444        global $wp_version;
     45
     46        if ( !function_exists('fsockopen') )
     47                return false;
     48
    4549        $plugins = get_plugins();
    4650        $active  = get_option( 'active_plugins' );
    4751        $current = get_option( 'update_plugins' );
     
    8387        $http_request .= $request;
    8488
    8589        $response = '';
    86         if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) ) {
     90        if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
    8791                fwrite($fs, $http_request);
    8892
    8993                while ( !feof($fs) )