Plugin Dependencies: Ensure dependency detection for newly installed plugins.

Resolves a bug by first initializing in the AJAX callback `WP_Plugin_Dependencies::check_plugin_dependencies_during_ajax()`.

More details:

[57658] removed auto-deactivation and bootstrapping logic from the Plugin Dependencies feature. In doing so, initialization calls were added to various locations in Core to ensure dependencies were detected and ready to be checked. However, an initialization call was missed in the AJAX callback before checking plugin dependencies.

This means that a plugin's dependencies may not be detected, and lead to a false positive, which in turn allows the user to click Activate only to see a failure message.

Follow-up to [57658].

Props kevinwhoffman, costdev, afragen.
Fixes .

git-svn-id: https://develop.svn.wordpress.org/trunk@58252 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork 2024-05-30 15:13:58 +00:00
parent b62bd796eb
commit 20b0c74187

@ -488,6 +488,7 @@ class WP_Plugin_Dependencies {
$status['activateUrl'] = add_query_arg( array( 'networkwide' => 1 ), $status['activateUrl'] );
}
self::initialize();
$dependencies = self::get_dependencies( $plugin_file );
if ( empty( $dependencies ) ) {
$status['message'] = __( 'The plugin has no required plugins.' );