Make clear that Plugin->setEnabled() is @internal

Use of this by plugins will produce a lot of undefined behaviour, such as event handlers not being unregistered, scheduled tasks not being removed, and registered permissions causing memory leaks.
This commit is contained in:
Dylan K. Taylor 2018-10-07 17:48:11 +01:00
parent adbd1c7bed
commit 10fa74b417
2 changed files with 12 additions and 0 deletions

View File

@ -55,6 +55,12 @@ interface Plugin extends CommandExecutor{
public function isEnabled() : bool; public function isEnabled() : bool;
/** /**
* Called by the plugin manager when the plugin is enabled or disabled to inform the plugin of its enabled state.
*
* @internal This is intended for core use only and should not be used by plugins
* @see PluginManager::enablePlugin()
* @see PluginManager::disablePlugin()
*
* @param bool $enabled * @param bool $enabled
*/ */
public function setEnabled(bool $enabled = true) : void; public function setEnabled(bool $enabled = true) : void;

View File

@ -93,6 +93,12 @@ abstract class PluginBase implements Plugin{
} }
/** /**
* Called by the plugin manager when the plugin is enabled or disabled to inform the plugin of its enabled state.
*
* @internal This is intended for core use only and should not be used by plugins
* @see PluginManager::enablePlugin()
* @see PluginManager::disablePlugin()
*
* @param bool $enabled * @param bool $enabled
*/ */
final public function setEnabled(bool $enabled = true) : void{ final public function setEnabled(bool $enabled = true) : void{