Plugin_Upgrader::active_after()publicWP 5.4.0

Turns off maintenance mode after upgrading an active plugin.

Hooked to the upgrader_post_install filter by Plugin_Upgrader::upgrade().

{} Это метод класса: Plugin_Upgrader{}

Хуков нет.

Возвращает

true|false|WP_Error. The original $response parameter or WP_Error.

Использование

$Plugin_Upgrader = new Plugin_Upgrader();
$Plugin_Upgrader->active_after( $response, $plugin );
$response(true|false|WP_Error) (обязательный)
The installation response after the installation has finished.
$plugin(массив) (обязательный)
Plugin package arguments.

Список изменений

С версии 5.4.0 Введена.

Код Plugin_Upgrader::active_after() WP 6.0.2

public function active_after( $response, $plugin ) {
	if ( is_wp_error( $response ) ) {
		return $response;
	}

	// Only disable maintenance mode when in cron (background update).
	if ( ! wp_doing_cron() ) {
		return $response;
	}

	$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';

	// Only run if plugin is active.
	if ( ! is_plugin_active( $plugin ) ) {
		return $response;
	}

	// Time to remove maintenance mode. Bulk edit handles this separately.
	if ( ! $this->bulk ) {
		$this->maintenance_mode( false );
	}

	return $response;
}