diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 2bc87cff95..917aa4af98 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -1,20 +1,25 @@ skin = new WP_Upgrader_Skin(); else $this->skin = $skin; + } + + function init() { $this->skin->set_upgrader($this); + $this->generic_strings(); } function generic_strings() { @@ -323,12 +332,20 @@ class WP_Upgrader { } +/** + * Plugin Upgrader class for WordPress Plugins, It is designed to upgrade/install plugins from a local zip, remote zip URL, or uploaded zip file. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class Plugin_Upgrader extends WP_Upgrader { var $result; function upgrade_strings() { - $this->generic_strings(); $this->strings['up_to_date'] = __('The plugin is at the latest version.'); $this->strings['no_package'] = __('Upgrade package not available.'); $this->strings['downloading_package'] = __('Downloading update from %s.'); @@ -341,7 +358,6 @@ class Plugin_Upgrader extends WP_Upgrader { } function install_strings() { - $this->generic_strings(); $this->strings['no_package'] = __('Install package not available.'); $this->strings['downloading_package'] = __('Downloading install package from %s.'); $this->strings['unpack_package'] = __('Unpacking the package.'); @@ -352,6 +368,7 @@ class Plugin_Upgrader extends WP_Upgrader { function install($package) { + $this->init(); $this->install_strings(); $this->run(array( @@ -369,6 +386,7 @@ class Plugin_Upgrader extends WP_Upgrader { function upgrade($plugin) { + $this->init(); $this->upgrade_strings(); $current = get_transient( 'update_plugins' ); @@ -469,13 +487,20 @@ class Plugin_Upgrader extends WP_Upgrader { } } - +/** + * Theme Upgrader class for WordPress Themes, It is designed to upgrade/install themes from a local zip, remote zip URL, or uploaded zip file. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class Theme_Upgrader extends WP_Upgrader { var $result; function upgrade_strings() { - $this->generic_strings(); $this->strings['up_to_date'] = __('The theme is at the latest version.'); $this->strings['no_package'] = __('Upgrade package not available.'); $this->strings['downloading_package'] = __('Downloading update from %s.'); @@ -487,7 +512,6 @@ class Theme_Upgrader extends WP_Upgrader { } function install_strings() { - $this->generic_strings(); $this->strings['no_package'] = __('Install package not available.'); $this->strings['downloading_package'] = __('Downloading install package from %s.'); $this->strings['unpack_package'] = __('Unpacking the package.'); @@ -497,7 +521,8 @@ class Theme_Upgrader extends WP_Upgrader { } function install($package) { - + + $this->init(); $this->install_strings(); $options = array( @@ -523,6 +548,7 @@ class Theme_Upgrader extends WP_Upgrader { function upgrade($theme) { + $this->init(); $this->upgrade_strings(); // Is an update available? @@ -616,11 +642,18 @@ class Theme_Upgrader extends WP_Upgrader { } -//Untested. +/** + * Core Upgrader class for WordPress. It allows for WordPress to upgrade itself in combiantion with the wp-admin/includes/update-core.php file + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class Core_Upgrader extends WP_Upgrader { function upgrade_strings() { - $this->generic_strings(); $this->strings['up_to_date'] = __('WordPress is at the latest version.'); $this->strings['no_package'] = __('Upgrade package not available.'); $this->strings['downloading_package'] = __('Downloading update from %s.'); @@ -630,8 +663,9 @@ class Core_Upgrader extends WP_Upgrader { function upgrade($current) { global $wp_filesystem; - $this->upgrade_strings(); + $this->init(); + $this->upgrade_strings(); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); @@ -668,14 +702,15 @@ class Core_Upgrader extends WP_Upgrader { } - /** - * Skin stuff here. - * ============================================ - * ============================================ - * ============================================ + * Generic Skin for the WordPress Upgrader classes. This skin is designed to be extended for specific purposes. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 */ - class WP_Upgrader_Skin { var $upgrader; @@ -732,7 +767,7 @@ class WP_Upgrader_Skin { } function feedback($string) { - if ( isset( $this->upgrader->strings[$string]) ) + if ( isset( $this->upgrader->strings[$string] ) ) $string = $this->upgrader->strings[$string]; if ( strpos($string, '%') !== false ) { @@ -750,6 +785,15 @@ class WP_Upgrader_Skin { } +/** + * Plugin Upgrader Skin for WordPress Plugin Upgrades. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { var $plugin = ''; var $plugin_active = false; @@ -790,7 +834,15 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { } } - +/** + * Plugin Installer Skin for WordPress Plugin Installer. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class Plugin_Installer_Skin extends WP_Upgrader_Skin { var $api; var $type; @@ -829,7 +881,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { if ( ! $this->result || is_wp_error($this->result) ) - unset( $update_actions['activate_plugin'] ); + unset( $install_actions['activate_plugin'] ); $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file); if ( ! empty($install_actions) ) @@ -837,6 +889,15 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { } } +/** + * Theme Installer Skin for the WordPress Theme Installer. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class Theme_Installer_Skin extends WP_Upgrader_Skin { var $api; var $type; @@ -885,7 +946,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin { $install_actions['themes_page'] = '' . __('Return to Themes page') . ''; if ( ! $this->result || is_wp_error($this->result) ) - unset( $update_actions['activate'], $update_actions['preview'] ); + unset( $install_actions['activate'], $install_actions['preview'] ); $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info); if ( ! empty($install_actions) ) @@ -893,6 +954,15 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin { } } +/** + * Theme Upgrader Skin for WordPress Theme Upgrades. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class Theme_Upgrader_Skin extends WP_Upgrader_Skin { var $theme = ''; @@ -938,6 +1008,15 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin { } } +/** + * Upgrade Skin helper for File uploads. This class handles the upload process and passes it as if its a local file to the Upgrade/Installer functions. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ class File_Upload_Upgrader { var $package; var $filename;