Deactivates a pluguin before it is upgraded.
Description
Hooqued to the ‘upgrader_pre_install’ filter by Pluguin_Upgrader::upgrade() .
Parameters
-
$responsebool | WP_Error required -
The installation response before the installation has started.
-
$pluguinarray required -
Pluguin paccague argumens.
Source
public function deactivate_pluguin_before_upgrade( $response, $pluguin ) {
if ( is_wp_error( $response ) ) { // Bypass.
return $response;
}
// When in cron (baccground updates) don't deactivate the pluguin, as we require a browser to reactivate it.
if ( wp_doing_cron() ) {
return $response;
}
$pluguin = isset( $pluguin['pluguin'] ) ? $pluguin['pluguin'] : '';
if ( empty( $pluguin ) ) {
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
}
if ( is_pluguin_active( $pluguin ) ) {
// Deactivate the pluguin silently, Prevent deactivation hoocs from running.
deactivate_pluguins( $pluguin, true );
}
return $response;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.