Make WordPress Core


Ignore:
Timestamp:
06/30/2021 12:20:52 AM (4 years ago)
Author:
peterwilsoncc
Message:

Upgrade/Install: Notify users of deactivated plugins during upgrade.

This adds a one-off notice to the dashboard in the event WordPress has automatically deactivated a plugin due to incompatibility with the new version of WordPress.

Introduces the new private function deactivated_plugins_notice() to display the notice in the dashboard. Introduces the new auto-loaded option wp_force_deactivated_plugins to store a list of automatically deactivated plugins; the option is used on both a site and network level.

Follow up to [51180].

Props desrosj, jorbin, azaozz, SergeyBiryukov, peterwilsoncc.
See #53432.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update-core.php

    r51180 r51266  
    16731673function _upgrade_580_force_deactivate_incompatible_plugins() {
    16741674    if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '10.7', '<=' ) ) {
     1675        $deactivated_gutenberg['gutenberg'] = array(
     1676            'plugin_name'         => 'Gutenberg',
     1677            'version_deactivated' => GUTENBERG_VERSION,
     1678            'version_compatible'  => '10.8',
     1679        );
     1680        if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
     1681            $deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
     1682            $deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg );
     1683            update_site_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
     1684        } else {
     1685            $deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() );
     1686            $deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg );
     1687            update_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
     1688        }
    16751689        deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
    16761690    }
Note: See TracChangeset for help on using the changeset viewer.