Make WordPress Core


Ignore:
Timestamp:
04/02/2014 01:04:30 PM (13 years ago)
Author:
dd32
Message:

Background Updates: Record Plugin & Theme update statistics like we for for Core updates, Pass Plugin/Theme update objects into the Background updater for consistency with Core & Translations. See #27633

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-upgrader.php

    r27801 r27905  
    19751975                        return false;
    19761976
     1977                $upgrader_item = $item;
    19771978                switch ( $type ) {
    19781979                        case 'core':
    … …  
    19811982                                break;
    19821983                        case 'theme':
    1983                                 $theme = wp_get_theme( $item );
     1984                                $upgrader_item = $item->theme;
     1985                                $theme = wp_get_theme( $upgrader_item );
    19841986                                $item_name = $theme->Get( 'Name' );
    19851987                                $skin->feedback( __( 'Updating theme: %s' ), $item_name );
    19861988                                break;
    19871989                        case 'plugin':
    1988                                 $plugin_data = get_plugin_data( $context . '/' . $item );
     1990                                $upgrader_item = $item->plugin;
     1991                                $plugin_data = get_plugin_data( $context . '/' . $upgrader_item );
    19891992                                $item_name = $plugin_data['Name'];
    19901993                                $skin->feedback( __( 'Updating plugin: %s' ), $item_name );
    … …  
    19982001
    19992002                // 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(
    20012004                        'clear_update_cache' => false,
    20022005                        'pre_check_md5'      => false, /* always use partial builds if possible for core updates */
    … …  
    20722075                $plugin_updates = get_site_transient( 'update_plugins' );
    20732076                if ( $plugin_updates && !empty( $plugin_updates->response ) ) {
    2074                         foreach ( array_keys( $plugin_updates->response ) as $plugin ) {
     2077                        foreach ( $plugin_updates->response as $plugin ) {
    20752078                                $this->update( 'plugin', $plugin );
    20762079                        }
    … …  
    20832086                $theme_updates = get_site_transient( 'update_themes' );
    20842087                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 );
    20872090                        }
    20882091                        // Force refresh of theme update information
    … …  
    20992102                // Clean up, and check for any pending translations
    21002103                // (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
    21032119
    21042120                // Finally, Process any new translations
Note: See TracChangeset for help on using the changeset viewer.