Ticket #7875: 7875.9.diff

File 7875.9.diff, 4.0 KB (added by DD32, 3 years ago)
  • wp-admin/includes/class-wp-upgrader.php

     
    2828                        $this->skin = new WP_Upgrader_Skin(); 
    2929                else 
    3030                        $this->skin = $skin; 
     31        } 
     32         
     33        function init() { 
    3134                $this->skin->set_upgrader($this); 
     35                $this->generic_strings(); 
    3236        } 
    3337 
    3438        function generic_strings() { 
     
    328332        var $result; 
    329333 
    330334        function upgrade_strings() { 
    331                 $this->generic_strings(); 
    332335                $this->strings['up_to_date'] = __('The plugin is at the latest version.'); 
    333336                $this->strings['no_package'] = __('Upgrade package not available.'); 
    334337                $this->strings['downloading_package'] = __('Downloading update from %s.'); 
     
    341344        } 
    342345 
    343346        function install_strings() { 
    344                 $this->generic_strings(); 
    345347                $this->strings['no_package'] = __('Install package not available.'); 
    346348                $this->strings['downloading_package'] = __('Downloading install package from %s.'); 
    347349                $this->strings['unpack_package'] = __('Unpacking the package.'); 
     
    352354 
    353355        function install($package) { 
    354356 
     357                $this->init(); 
    355358                $this->install_strings(); 
    356359 
    357360                $this->run(array( 
     
    369372 
    370373        function upgrade($plugin) { 
    371374 
     375                $this->init(); 
    372376                $this->upgrade_strings(); 
    373377 
    374378                $current = get_transient( 'update_plugins' ); 
     
    475479        var $result; 
    476480 
    477481        function upgrade_strings() { 
    478                 $this->generic_strings(); 
    479482                $this->strings['up_to_date'] = __('The theme is at the latest version.'); 
    480483                $this->strings['no_package'] = __('Upgrade package not available.'); 
    481484                $this->strings['downloading_package'] = __('Downloading update from %s.'); 
     
    487490        } 
    488491 
    489492        function install_strings() { 
    490                 $this->generic_strings(); 
    491493                $this->strings['no_package'] = __('Install package not available.'); 
    492494                $this->strings['downloading_package'] = __('Downloading install package from %s.'); 
    493495                $this->strings['unpack_package'] = __('Unpacking the package.'); 
     
    497499        } 
    498500 
    499501        function install($package) { 
    500  
     502                 
     503                $this->init(); 
    501504                $this->install_strings(); 
    502505 
    503506                $options = array( 
     
    523526 
    524527        function upgrade($theme) { 
    525528 
     529                $this->init(); 
    526530                $this->upgrade_strings(); 
    527531 
    528532                // Is an update available? 
     
    616620 
    617621} 
    618622 
    619 //Untested. 
     623 
    620624class Core_Upgrader extends WP_Upgrader { 
    621625 
    622626        function upgrade_strings() { 
    623                 $this->generic_strings(); 
    624627                $this->strings['up_to_date'] = __('WordPress is at the latest version.'); 
    625628                $this->strings['no_package'] = __('Upgrade package not available.'); 
    626629                $this->strings['downloading_package'] = __('Downloading update from %s.'); 
     
    630633 
    631634        function upgrade($current) { 
    632635                global $wp_filesystem; 
     636 
     637                $this->init(); 
    633638                $this->upgrade_strings(); 
    634639 
    635  
    636640                if ( !empty($feedback) ) 
    637641                        add_filter('update_feedback', $feedback); 
    638642 
     
    732736        } 
    733737 
    734738        function feedback($string) { 
    735                 if ( isset( $this->upgrader->strings[$string]) ) 
     739                if ( isset( $this->upgrader->strings[$string] ) ) 
    736740                        $string = $this->upgrader->strings[$string]; 
    737741 
    738742                if ( strpos($string, '%') !== false ) { 
     
    829833 
    830834 
    831835                if ( ! $this->result || is_wp_error($this->result) ) 
    832                         unset( $update_actions['activate_plugin'] ); 
     836                        unset( $install_actions['activate_plugin'] ); 
    833837 
    834838                $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file); 
    835839                if ( ! empty($install_actions) ) 
     
    885889                        $install_actions['themes_page'] = '<a href="' . admin_url('themes.php') . '" title="' . attribute_escape(__('Themes page')) . '" target="_parent">' . __('Return to Themes page') . '</a>'; 
    886890 
    887891                if ( ! $this->result || is_wp_error($this->result) ) 
    888                         unset( $update_actions['activate'], $update_actions['preview'] ); 
     892                        unset( $install_actions['activate'], $install_actions['preview'] ); 
    889893 
    890894                $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info); 
    891895                if ( ! empty($install_actions) )