Make WordPress Core


Ignore:
Timestamp:
02/20/2024 07:25:38 AM (16 months ago)
Author:
costdev
Message:

Plugin Dependencies: Remove auto-deactivation and bootstrapping logic.

Automatic deactivation of dependents with unmet dependencies requires a write operation to the database. This was performed during Core's bootstrap, which risked the database and cache becoming out-of-sync on sites with heavy traffic.

No longer loading plugins that have unmet requirements has not had a final approach decided core-wide, and is still in discussion in #60491 to be handled in a future release.

The plugin_data option, used to persistently store plugin data for detecting unmet dependencies during Core's bootstrap, is no longer needed.

Follow-up to [57545], [57592], [57606], [57617].

Props dd32, azaozz, swissspidy, desrosj, afragen, pbiron, zunaid321, costdev.
Fixes #60457. See #60491, #60510, #60518.

File:
1 edited

Legend:

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

    r57644 r57658  
    334334    }
    335335
    336     $new_plugin_data = array();
    337336    foreach ( $plugin_files as $plugin_file ) {
    338337        if ( ! is_readable( "$plugin_root/$plugin_file" ) ) {
     
    347346        }
    348347
    349         $new_plugin_file = str_replace(
    350             trailingslashit( WP_PLUGIN_DIR ),
    351             '',
    352             "$plugin_root/$plugin_file"
    353         );
    354 
    355         $new_plugin_data[ $new_plugin_file ]           = $plugin_data;
    356348        $wp_plugins[ plugin_basename( $plugin_file ) ] = $plugin_data;
    357349    }
     
    361353    $cache_plugins[ $plugin_folder ] = $wp_plugins;
    362354    wp_cache_set( 'plugins', $cache_plugins, 'plugins' );
    363 
    364     if ( ! wp_installing() ) {
    365         update_option( 'plugin_data', $new_plugin_data );
    366     }
    367355
    368356    return $wp_plugins;
     
    976964
    977965    $plugin_translations = wp_get_installed_translations( 'plugins' );
    978     $all_plugin_data     = get_option( 'plugin_data', array() );
    979966
    980967    $errors = array();
     
    10211008            continue;
    10221009        }
    1023         unset( $all_plugin_data[ $plugin_file ] );
    10241010
    10251011        $plugin_slug = dirname( $plugin_file );
     
    10701056        return new WP_Error( 'could_not_remove_plugin', sprintf( $message, implode( ', ', $errors ) ) );
    10711057    }
    1072     update_option( 'plugin_data', $all_plugin_data );
    10731058
    10741059    return true;
     
    12151200    }
    12161201
     1202    WP_Plugin_Dependencies::initialize();
     1203
    12171204    if ( WP_Plugin_Dependencies::has_unmet_dependencies( $plugin ) ) {
    12181205        $dependencies       = WP_Plugin_Dependencies::get_dependencies( $plugin );
Note: See TracChangeset for help on using the changeset viewer.