Make WordPress Core


Ignore:
Timestamp:
04/03/2014 04:02:35 AM (12 years ago)
Author:
nacin
Message:

Background Updates: Record plugin & theme update statistics like we do for core updates.

Pass plugin/theme update objects into the Background updater for consistency with core & translations.

Merges [27905] to the 3.7 branch.

props dd32.
fixes #27633.

Location:
branches/3.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/src/wp-includes/update.php

    r26450 r27924  
    161161 * @uses $wp_version Used to notify the WordPress version.
    162162 *
     163 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
    163164 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
    164165 */
    165 function wp_update_plugins() {
     166function wp_update_plugins( $extra_stats = array() ) {
    166167    include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
    167168
     
    202203    $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
    203204
    204     if ( $time_not_changed ) {
     205    if ( $time_not_changed && ! $extra_stats ) {
    205206        $plugin_changed = false;
    206207        foreach ( $plugins as $file => $p ) {
     
    251252    );
    252253
     254    if ( $plugin_update_stats ) {
     255        $options['body']['update_stats'] = json_encode( $extra_stats );
     256    }
     257
    253258    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    254259    if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
     
    292297 * @uses $wp_version Used to notify the WordPress version.
    293298 *
     299 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
    294300 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
    295301 */
    296 function wp_update_themes() {
     302function wp_update_themes( $extra_stats = array() ) {
    297303    include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
    298304
     
    344350    $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked );
    345351
    346     if ( $time_not_changed ) {
     352    if ( $time_not_changed && ! $extra_stats ) {
    347353        $theme_changed = false;
    348354        foreach ( $checked as $slug => $v ) {
     
    390396        'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
    391397    );
     398
     399    if ( $theme_update_stats ) {
     400        $options['body']['update_stats'] = json_encode( $extra_stats );
     401    }
    392402
    393403    $url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
Note: See TracChangeset for help on using the changeset viewer.