wppaste
WordPress

Plugin_Upgrader

Since
2.8.0, 4.6.0
Source
wp-admin/includes/class-plugin-upgrader.php:21
Core class used for upgrading/installing plugins.

Description

It is designed to upgrade/install plugins from a local zip, remote zip URL, or uploaded zip file.

Compatibility

WordPress
since 4.6.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 2

Every hook that fires from inside Plugin_Upgrader, in the order it appears in the class, grouped by the method that fires it.

Properties · 3

$resultarray|WP_Errorpublic
Plugin upgrade result.
$bulkboolpublic
Whether a bulk upgrade/installation is being performed.
$new_plugin_dataarraypublic
New plugin info.

Methods · 11

Source code

class Plugin_Upgrader extends WP_Upgrader { 	/**	 * Plugin upgrade result.	 *	 * @since 2.8.0	 * @var array|WP_Error $result	 *	 * @see WP_Upgrader::$result	 */	public $result; 	/**	 * Whether a bulk upgrade/installation is being performed.	 *	 * @since 2.9.0	 * @var bool $bulk	 */	public $bulk = false; 	/**	 * New plugin info.	 *	 * @since 5.5.0	 * @var array $new_plugin_data	 *	 * @see check_package()	 */	public $new_plugin_data = array(); 	/**	 * Initializes the upgrade strings.	 *	 * @since 2.8.0	 */	public function upgrade_strings() {		$this->strings['up_to_date'] = __( 'The plugin is at the latest version.' );		$this->strings['no_package'] = __( 'Update package not available.' );		/* translators: %s: Package URL. */		$this->strings['downloading_package']  = sprintf( __( 'Downloading update from %s&#8230;' ), '<span class="code pre">%s</span>' );		$this->strings['unpack_package']       = __( 'Unpacking the update&#8230;' );		$this->strings['remove_old']           = __( 'Removing the old version of the plugin&#8230;' );		$this->strings['remove_old_failed']    = __( 'Could not remove the old plugin.' );		$this->strings['process_failed']       = __( 'Plugin update failed.' );		$this->strings['process_success']      = __( 'Plugin updated successfully.' );		$this->strings['process_bulk_success'] = __( 'Plugins updated successfully.' );	} 	/**	 * Initializes the installation strings.	 *	 * @since 2.8.0	 */	public function install_strings() {		$this->strings['no_package'] = __( 'Installation package not available.' );		/* translators: %s: Package URL. */		$this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s&#8230;' ), '<span class="code pre">%s</span>' );		$this->strings['unpack_package']      = __( 'Unpacking the package&#8230;' );		$this->strings['installing_package']  = __( 'Installing the plugin&#8230;' );		$this->strings['remove_old']          = __( 'Removing the current plugin&#8230;' );		$this->strings['remove_old_failed']   = __( 'Could not remove the current plugin.' );		$this->strings['no_files']            = __( 'The plugin contains no files.' );		$this->strings['process_failed']      = __( 'Plugin installation failed.' );		$this->strings['process_success']     = __( 'Plugin installed successfully.' );		/* translators: 1: Plugin name, 2: Plugin version. */		$this->strings['process_success_specific'] = __( 'Successfully installed the plugin <strong>%1$s %2$s</strong>.' ); 		if ( ! empty( $this->skin->overwrite ) ) {			if ( 'update-plugin' === $this->skin->overwrite ) {				$this->strings['installing_package'] = __( 'Updating the plugin&#8230;' );				$this->strings['process_failed']     = __( 'Plugin update failed.' );				$this->strings['process_success']    = __( 'Plugin updated successfully.' );			} 			if ( 'downgrade-plugin' === $this->skin->overwrite ) {				$this->strings['installing_package'] = __( 'Downgrading the plugin&#8230;' );				$this->strings['process_failed']     = __( 'Plugin downgrade failed.' );				$this->strings['process_success']    = __( 'Plugin downgraded successfully.' );			}		}

Changelog

Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.6.0
Moved to its own file from wp-admin/includes/class-wp-upgrader.php.from the docblock
2.8.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/class-plugin-upgrader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.