Changeset 27905
- Timestamp:
- 04/02/2014 01:04:30 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r27801 r27905 1975 1975 return false; 1976 1976 1977 $upgrader_item = $item; 1977 1978 switch ( $type ) { 1978 1979 case 'core': … … 1981 1982 break; 1982 1983 case 'theme': 1983 $theme = wp_get_theme( $item ); 1984 $upgrader_item = $item->theme; 1985 $theme = wp_get_theme( $upgrader_item ); 1984 1986 $item_name = $theme->Get( 'Name' ); 1985 1987 $skin->feedback( __( 'Updating theme: %s' ), $item_name ); 1986 1988 break; 1987 1989 case 'plugin': 1988 $plugin_data = get_plugin_data( $context . '/' . $item ); 1990 $upgrader_item = $item->plugin; 1991 $plugin_data = get_plugin_data( $context . '/' . $upgrader_item ); 1989 1992 $item_name = $plugin_data['Name']; 1990 1993 $skin->feedback( __( 'Updating plugin: %s' ), $item_name ); … … 1998 2001 1999 2002 // Boom, This sites about to get a whole new splash of paint! 2000 $upgrade_result = $upgrader->upgrade( $ item, array(2003 $upgrade_result = $upgrader->upgrade( $upgrader_item, array( 2001 2004 'clear_update_cache' => false, 2002 2005 'pre_check_md5' => false, /* always use partial builds if possible for core updates */ … … 2072 2075 $plugin_updates = get_site_transient( 'update_plugins' ); 2073 2076 if ( $plugin_updates && !empty( $plugin_updates->response ) ) { 2074 foreach ( array_keys( $plugin_updates->response )as $plugin ) {2077 foreach ( $plugin_updates->response as $plugin ) { 2075 2078 $this->update( 'plugin', $plugin ); 2076 2079 } … … 2083 2086 $theme_updates = get_site_transient( 'update_themes' ); 2084 2087 if ( $theme_updates && !empty( $theme_updates->response ) ) { 2085 foreach ( array_keys( $theme_updates->response )as $theme ) {2086 $this->update( 'theme', $theme );2088 foreach ( $theme_updates->response as $theme ) { 2089 $this->update( 'theme', (object) $theme ); 2087 2090 } 2088 2091 // Force refresh of theme update information … … 2099 2102 // Clean up, and check for any pending translations 2100 2103 // (Core_Upgrader checks for core updates) 2101 wp_update_themes(); // Check for Theme updates 2102 wp_update_plugins(); // Check for Plugin updates 2104 $theme_stats = array(); 2105 if ( isset( $this->update_results['theme'] ) ) { 2106 foreach ( $this->update_results['theme'] as $upgrade ) { 2107 $theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result ); 2108 } 2109 } 2110 wp_update_themes( $theme_stats ); // Check for Theme updates 2111 2112 $plugin_stats = array(); 2113 if ( isset( $this->update_results['plugin'] ) ) { 2114 foreach ( $this->update_results['plugin'] as $upgrade ) { 2115 $plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result ); 2116 } 2117 } 2118 wp_update_plugins( $plugin_stats ); // Check for Plugin updates 2103 2119 2104 2120 // Finally, Process any new translations -
trunk/src/wp-includes/update.php
r27369 r27905 167 167 * @uses $wp_version Used to notify the WordPress version. 168 168 * 169 * @param array $extra_stats Extra statistics to report to the WordPress.org API. 169 170 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 170 171 */ 171 function wp_update_plugins( ) {172 function wp_update_plugins( $extra_stats = array() ) { 172 173 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 173 174 … … 208 209 $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); 209 210 210 if ( $time_not_changed ) {211 if ( $time_not_changed && ! $extra_stats ) { 211 212 $plugin_changed = false; 212 213 foreach ( $plugins as $file => $p ) { … … 257 258 ); 258 259 260 if ( $plugin_update_stats ) { 261 $options['body']['update_stats'] = json_encode( $extra_stats ); 262 } 263 259 264 $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/'; 260 265 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) … … 297 302 * @uses $wp_version Used to notify the WordPress version. 298 303 * 304 * @param array $extra_stats Extra statistics to report to the WordPress.org API. 299 305 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 300 306 */ 301 function wp_update_themes( ) {307 function wp_update_themes( $extra_stats = array() ) { 302 308 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 303 309 … … 349 355 $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked ); 350 356 351 if ( $time_not_changed ) {357 if ( $time_not_changed && ! $extra_stats ) { 352 358 $theme_changed = false; 353 359 foreach ( $checked as $slug => $v ) { … … 395 401 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 396 402 ); 403 404 if ( $theme_update_stats ) { 405 $options['body']['update_stats'] = json_encode( $extra_stats ); 406 } 397 407 398 408 $url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
Note: See TracChangeset
for help on using the changeset viewer.