WP_Upgrader
- Since
- 2.8.0
- Source
wp-admin/includes/class-wp-upgrader.php:51
Core class used for upgrading/installing a local set of files via the Filesystem Abstraction classes from a Zip file.
Compatibility
- WordPress
- since 2.8.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 · 8
Every hook that fires from inside WP_Upgrader, in the order it appears in the class, grouped by the method that fires it.
WP_Upgrader::install_package()
- apply_filters( upgrader_pre_install )filter line 552
- apply_filters( upgrader_source_selection )filter line 597
- apply_filters( upgrader_clear_destination )filter line 659
- apply_filters( upgrader_post_install )filter line 726
WP_Upgrader::run()
- apply_filters( upgrader_package_options )filter line 814
- apply_filters( upgrader_install_package_result )filter line 913
- do_action( upgrader_process_complete )action line 984
Properties · 7
$stringsarraypublic- The error/notification strings used to update the user on the progress.
$skinAutomatic_Upgrader_Skin|WP_Upgrader_Skinpublic- The upgrader skin being used.
$resultarray|WP_Errorpublic- The result of the installation.
$update_countintpublic- The total number of updates being performed.
$update_currentintpublic- The current update if multiple updates are being performed.
$temp_backupsarrayprivate- Stores the list of plugins or themes added to temporary backup directory.
$temp_restoresarrayprivate- Stores the list of plugins or themes to be restored from temporary backup directory.
Methods · 17
- __construct()Construct the upgrader with a skin.
- init()Initializes the upgrader.
- schedule_temp_backup_cleanup()Schedules the cleanup of the temporary backup directory.
- generic_strings()Adds the generic strings to WP_Upgrader::$strings.
- fs_connect()Connects to the filesystem.
- download_package()Downloads a package.
- unpack_package()Unpacks a compressed package file.
- flatten_dirlist()Flattens the results of WP_Filesystem_Base::dirlist() for iterating over.
- clear_destination()Clears the directory where this item is going to be installed into.
- install_package()Install a package.
- run()Runs an upgrade/installation.
- maintenance_mode()Toggles maintenance mode for the site.
- create_lock()Creates a lock using WordPress options.
- release_lock()Releases an upgrader lock.
- move_to_temp_backup_dir()Moves the plugin or theme being updated into a temporary backup directory.
- restore_temp_backup()Restores the plugin or theme from temporary backup.
- delete_temp_backup()Deletes a temporary backup.
Source code
#[AllowDynamicProperties]class WP_Upgrader { /** * The error/notification strings used to update the user on the progress. * * @since 2.8.0 * @var array $strings */ public $strings = array(); /** * The upgrader skin being used. * * @since 2.8.0 * @var Automatic_Upgrader_Skin|WP_Upgrader_Skin $skin */ public $skin = null; /** * The result of the installation. * * This is set by WP_Upgrader::install_package(), only when the package is installed * successfully. It will then be an array, unless a WP_Error is returned by the * {@see 'upgrader_post_install'} filter. In that case, the WP_Error will be assigned to * it. * * @since 2.8.0 * * @var array|WP_Error $result { * @type string $source The full path to the source the files were installed from. * @type string $source_files List of all the files in the source directory. * @type string $destination The full path to the installation destination folder. * @type string $destination_name The name of the destination folder, or empty if `$destination` * and `$local_destination` are the same. * @type string $local_destination The full local path to the destination folder. This is usually * the same as `$destination`. * @type string $remote_destination The full remote path to the destination folder * (i.e., from `$wp_filesystem`). * @type bool $clear_destination Whether the destination folder was cleared. * } */ public $result = array(); /** * The total number of updates being performed. * * Set by the bulk update methods. * * @since 3.0.0 * @var int $update_count */ public $update_count = 0; /** * The current update if multiple updates are being performed. * * Used by the bulk update methods, and incremented for each update. * * @since 3.0.0 * @var int */ public $update_current = 0; /** * Stores the list of plugins or themes added to temporary backup directory. * * Used by the rollback functions. * * @since 6.3.0 * @var array */ private $temp_backups = array(); /** * Stores the list of plugins or themes to be restored from temporary backup directory. * * Used by the rollback functions. * * @since 6.3.0Changelog
Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-admin/includes/class-wp-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.