Make WordPress Core


Ignore:
Timestamp:
09/20/2013 05:54:41 AM (13 years ago)
Author:
nacin
Message:

Further adjust the request and response formats for plugin and theme update checks. see #25311.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/update.php

    r25466 r25514  
    197197        set_site_transient( 'update_plugins', $current );
    198198
    199         $to_send = (object) compact('plugins', 'active');
     199        $to_send = compact( 'plugins', 'active' );
    200200
    201201        $options = array(
    202202                'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
    203                 'body' => array( 'plugins' => serialize( $to_send ) ),
     203                'body' => array( 'plugins' => json_encode( $to_send ) ),
    204204                'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
    205205        );
     
    217217
    218218        if ( is_object( $response ) )
    219                 $new_option->response = (array) $response;
     219                $new_option->response = (array) $response->plugins;
    220220        else
    221221                $new_option->response = array();
     
    248248                $last_update = new stdClass;
    249249
    250         $themes = array();
    251         $checked = array();
     250        $themes = $checked = $request = array();
    252251
    253252        // Put slug of current theme into request.
    254         $themes['current_theme'] = get_option( 'stylesheet' );
     253        $request['active'] = get_option( 'stylesheet' );
    255254
    256255        foreach ( $installed_themes as $theme ) {
     
    308307        set_site_transient( 'update_themes', $last_update );
    309308
     309        $request['themes'] = $themes;
     310
    310311        $options = array(
    311312                'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
    312                 'body'                  => array( 'themes' => serialize( $themes ) ),
     313                'body'                  => array( 'themes' => json_encode( $request ) ),
    313314                'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
    314315        );
     
    328329
    329330        $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
     331
    330332        if ( is_array( $response ) )
    331                 $new_update->response = $response;
     333                $new_update->response = $response['themes'];
    332334
    333335        set_site_transient( 'update_themes', $new_update );
Note: See TracChangeset for help on using the changeset viewer.