PluginManager: fixed mishandling of self-disabling plugins in enablePlugins()

this caused a leak of the plugin context, PluginEnableEvent to be called with a disabled plugin, and the plugin's scheduler to get ticked.
This commit is contained in:
Dylan K. Taylor 2022-03-03 18:48:52 +00:00
parent 3e90c3072a
commit c9c50e16ec
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -435,10 +435,11 @@ class PluginManager{
$plugin->getScheduler()->setEnabled(true);
$plugin->onEnableStateChange(true);
if($plugin->isEnabled()){ //the plugin may have disabled itself during onEnable()
$this->enabledPlugins[$plugin->getDescription()->getName()] = $plugin;
$this->enabledPlugins[$plugin->getDescription()->getName()] = $plugin;
(new PluginEnableEvent($plugin))->call();
(new PluginEnableEvent($plugin))->call();
}
}
}