Changeset 27924
- Timestamp:
- 04/03/2014 04:02:35 AM (11 years ago)
- Location:
- branches/3.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.7
-
branches/3.7/src/wp-admin/includes/class-wp-upgrader.php
r27883 r27924 1873 1873 return false; 1874 1874 1875 $upgrader_item = $item; 1875 1876 switch ( $type ) { 1876 1877 case 'core': … … 1879 1880 break; 1880 1881 case 'theme': 1881 $theme = wp_get_theme( $item ); 1882 $upgrader_item = $item->theme; 1883 $theme = wp_get_theme( $upgrader_item ); 1882 1884 $item_name = $theme->Get( 'Name' ); 1883 1885 $skin->feedback( __( 'Updating theme: %s' ), $item_name ); 1884 1886 break; 1885 1887 case 'plugin': 1886 $plugin_data = get_plugin_data( $context . '/' . $item ); 1888 $upgrader_item = $item->plugin; 1889 $plugin_data = get_plugin_data( $context . '/' . $upgrader_item ); 1887 1890 $item_name = $plugin_data['Name']; 1888 1891 $skin->feedback( __( 'Updating plugin: %s' ), $item_name ); … … 1896 1899 1897 1900 // Boom, This sites about to get a whole new splash of paint! 1898 $upgrade_result = $upgrader->upgrade( $ item, array(1901 $upgrade_result = $upgrader->upgrade( $upgrader_item, array( 1899 1902 'clear_update_cache' => false, 1900 1903 'pre_check_md5' => false, /* always use partial builds if possible for core updates */ … … 1970 1973 $plugin_updates = get_site_transient( 'update_plugins' ); 1971 1974 if ( $plugin_updates && !empty( $plugin_updates->response ) ) { 1972 foreach ( array_keys( $plugin_updates->response )as $plugin ) {1975 foreach ( $plugin_updates->response as $plugin ) { 1973 1976 $this->update( 'plugin', $plugin ); 1974 1977 } … … 1981 1984 $theme_updates = get_site_transient( 'update_themes' ); 1982 1985 if ( $theme_updates && !empty( $theme_updates->response ) ) { 1983 foreach ( array_keys( $theme_updates->response )as $theme ) {1984 $this->update( 'theme', $theme );1986 foreach ( $theme_updates->response as $theme ) { 1987 $this->update( 'theme', (object) $theme ); 1985 1988 } 1986 1989 // Force refresh of theme update information … … 1997 2000 // Clean up, and check for any pending translations 1998 2001 // (Core_Upgrader checks for core updates) 1999 wp_update_themes(); // Check for Theme updates 2000 wp_update_plugins(); // Check for Plugin updates 2002 $theme_stats = array(); 2003 if ( isset( $this->update_results['theme'] ) ) { 2004 foreach ( $this->update_results['theme'] as $upgrade ) { 2005 $theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result ); 2006 } 2007 } 2008 wp_update_themes( $theme_stats ); // Check for Theme updates 2009 2010 $plugin_stats = array(); 2011 if ( isset( $this->update_results['plugin'] ) ) { 2012 foreach ( $this->update_results['plugin'] as $upgrade ) { 2013 $plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result ); 2014 } 2015 } 2016 wp_update_plugins( $plugin_stats ); // Check for Plugin updates 2001 2017 2002 2018 // Finally, Process any new translations -
branches/3.7/src/wp-includes/update.php
r26450 r27924 161 161 * @uses $wp_version Used to notify the WordPress version. 162 162 * 163 * @param array $extra_stats Extra statistics to report to the WordPress.org API. 163 164 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 164 165 */ 165 function wp_update_plugins( ) {166 function wp_update_plugins( $extra_stats = array() ) { 166 167 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 167 168 … … 202 203 $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); 203 204 204 if ( $time_not_changed ) {205 if ( $time_not_changed && ! $extra_stats ) { 205 206 $plugin_changed = false; 206 207 foreach ( $plugins as $file => $p ) { … … 251 252 ); 252 253 254 if ( $plugin_update_stats ) { 255 $options['body']['update_stats'] = json_encode( $extra_stats ); 256 } 257 253 258 $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/'; 254 259 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) … … 292 297 * @uses $wp_version Used to notify the WordPress version. 293 298 * 299 * @param array $extra_stats Extra statistics to report to the WordPress.org API. 294 300 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 295 301 */ 296 function wp_update_themes( ) {302 function wp_update_themes( $extra_stats = array() ) { 297 303 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 298 304 … … 344 350 $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked ); 345 351 346 if ( $time_not_changed ) {352 if ( $time_not_changed && ! $extra_stats ) { 347 353 $theme_changed = false; 348 354 foreach ( $checked as $slug => $v ) { … … 390 396 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 391 397 ); 398 399 if ( $theme_update_stats ) { 400 $options['body']['update_stats'] = json_encode( $extra_stats ); 401 } 392 402 393 403 $url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
Note: See TracChangeset
for help on using the changeset viewer.