From 525914a254623b0274615baeeb79a869776db374 Mon Sep 17 00:00:00 2001 From: Allen Benny <48691514+officiallygod@users.noreply.github.com> Date: Wed, 22 Feb 2023 12:04:51 +0530 Subject: [PATCH] Checks to prevent re-queuing plugins --- includes/RestApi/PluginsController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/RestApi/PluginsController.php b/includes/RestApi/PluginsController.php index 78e183b75..4e1904140 100644 --- a/includes/RestApi/PluginsController.php +++ b/includes/RestApi/PluginsController.php @@ -322,6 +322,15 @@ public function set_site_features( \WP_REST_Request $request ) { foreach ( $plugins as $plugin => $decision ) { if ( $decision ) { + // If the Plugin exists and is activated + if ( PluginInstaller::exists( $plugin, $decision ) ) + continue; + + // If the Plugin is already in queue + $position_in_queue = PluginInstallTaskManager::status( $plugin ); + if ( false !== $position_in_queue ) + continue; + PluginInstallTaskManager::add_to_queue( new PluginInstallTask( $plugin,