Upgrade/Install: Avoid unnecessary db operations for plugin dependencies.

The Plugin Dependencies feature saves a list of any plugins that have been disabled due to unmet dependencies to a transient in order to give user feedback in the admin about what has taken place. This ensures that the DB operations to write this transient is skipped if there are no dependent plugins to deactivate.

Props joemcgill, costdev, afragen.
Fixes #60518.


git-svn-id: https://develop.svn.wordpress.org/trunk@57617 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe McGill 2024-02-13 13:00:20 +00:00
parent 8c6a1db312
commit b9ab512d83

View File

@ -686,6 +686,11 @@ class WP_Plugin_Dependencies {
);
}
// Bail early if there are no dependents to deactivate.
if ( empty( $dependents_to_deactivate ) ) {
return;
}
$dependents_to_deactivate = array_unique( $dependents_to_deactivate );
deactivate_plugins( $dependents_to_deactivate );