Summery Summery
Deletes the old plugin during an upgrade.
Syntax Syntax
Description Description
Hooked to the ‘upgrader_clear_destination’ filter by Plugin_Upgrader::upgrade() and Plugin_Upgrader::bulk_upgrade().
Parameters Parameters
- $removed
-
(Required) Whether the destination was cleared. True on success, WP_Error on failure.
- $local_destination
-
(Required) The local package destination.
- $remote_destination
-
(Required) The remote package destination.
- $plugin
-
(Required) Extra arguments passed to hooked filters.
Return Return
(bool|WP_Error)
Source Source
File: wp-admin/includes/class-plugin-upgrader.php
}
/**
* Turns on maintenance mode before attempting to background update an active plugin.
*
* Hooked to the {@see 'upgrader_pre_install'} filter by Plugin_Upgrader::upgrade().
*
* @since 5.4.0
*
* @param bool|WP_Error $return Upgrade offer return.
* @param array $plugin Plugin package arguments.
* @return bool|WP_Error The passed in $return param or WP_Error.
*/
public function active_before( $return, $plugin ) {
if ( is_wp_error( $return ) ) {
return $return;
}
// Only enable maintenance mode when in cron (background update).
if ( ! wp_doing_cron() ) {
return $return;
}
$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
// Only run if plugin is active.
if ( ! is_plugin_active( $plugin ) ) {
return $return;
}
// Change to maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) {
$this->maintenance_mode( true );
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |