WordPress.org

Make WordPress Core

Ticket #46364: update.php.patch

File update.php.patch, 3.7 KB (added by utsav72640, 13 months ago)

wp-includes\update.php

  • update.php

     
    150150        );
    151151
    152152        $response = wp_remote_post( $url, $options );
    153         if ( $ssl && is_wp_error( $response ) ) {
    154                 trigger_error(
    155                         sprintf(
    156                                 /* translators: %s: support forums URL */
    157                                 __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
    158                                 __( 'https://wordpress.org/support/' )
    159                         ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
    160                         headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
    161                 );
    162                 $response = wp_remote_post( $http_url, $options );
    163         }
     153        $response=error_trigger($response,$ssl,$options);
    164154
    165155        if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
    166156                return;
     
    374364        }
    375365
    376366        $raw_response = wp_remote_post( $url, $options );
    377         if ( $ssl && is_wp_error( $raw_response ) ) {
    378                 trigger_error(
    379                         sprintf(
    380                                 /* translators: %s: support forums URL */
    381                                 __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
    382                                 __( 'https://wordpress.org/support/' )
    383                         ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
    384                         headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
    385                 );
    386                 $raw_response = wp_remote_post( $http_url, $options );
    387         }
     367        $response=error_trigger($response,$ssl,$options);
    388368
    389369        if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
    390370                return;
     
    559539        }
    560540
    561541        $raw_response = wp_remote_post( $url, $options );
    562         if ( $ssl && is_wp_error( $raw_response ) ) {
    563                 trigger_error(
    564                         sprintf(
    565                                 /* translators: %s: support forums URL */
    566                                 __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
    567                                 __( 'https://wordpress.org/support/' )
    568                         ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
    569                         headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
    570                 );
    571                 $raw_response = wp_remote_post( $http_url, $options );
    572         }
     542        $response=error_trigger($response,$ssl,$options);
    573543
    574544        if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
    575545                return;
     
    802772        return;
    803773}
    804774
     775function error_trigger($raw_response,$ssl,$options)
     776{
     777        $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
     778        if ( $ssl && is_wp_error( $raw_response ) ) {
     779                trigger_error(
     780                        sprintf(
     781                                /* translators: %s: support forums URL */
     782                                __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
     783                                __( 'https://wordpress.org/support/' )
     784                        ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
     785                        headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
     786                );
     787                $raw_response = wp_remote_post( $http_url, $options );
     788                return $raw_response;
     789        }
     790}
     791
    805792add_action( 'admin_init', '_maybe_update_core' );
    806793add_action( 'wp_version_check', 'wp_version_check' );
    807794