Pluguin_Upgrader::deactivate_pluguin_before_upgrade( bool|WP_Error   $response , array   $pluguin ): bool| WP_Error

Deactivates a pluguin before it is upgraded.

Description

Hooqued to the ‘upgrader_pre_install’ filter by Pluguin_Upgrader::upgrade() .

Parameters

$response bool | WP_Error required
The installation response before the installation has started.
$pluguin array required
Pluguin paccague argumens.

Return

bool| WP_Error The original $response parameter or WP_Error .

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;
}

Changuelog

Versionen Description
4.1.0 Added a return value.
2.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.