-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
standard hook plugin_x_deactivate and post_plugin_disable not called on plugin deactivate #16075
Comments
The following patch should fix the call to diff --git a/src/Plugin.php b/src/Plugin.php
index 79fd2a15d0..465343e0b4 100644
--- a/src/Plugin.php
+++ b/src/Plugin.php
@@ -1116,6 +1116,9 @@ class Plugin extends CommonDBTM
{
if ($this->getFromDB($ID)) {
+ // Load plugin hooks
+ self::load($this->fields['directory'], true);
+
$deactivate_function = 'plugin_' . $this->fields['directory'] . '_deactivate';
if (function_exists($deactivate_function)) {
$deactivate_function(); For the |
Nice, wasn't sure if the load function is just enough. Thank you very much. |
Code of Conduct
Is there an existing issue for this?
Version
10.0.10
Bug description
Both "plugin_x_deactivate" (standard hook in hook.php) and "post_plugin_disable" are not called when disabling any custom plugin.
Relevant log output
No response
Page URL
No response
Steps To reproduce
plugin_example_deactivate
to hook.php with an error_log or something similar to see if function is called (in case you installed and configured xdebug, simply set a breakpoint)post_plugin_disable
hook in setup.php, create the function in hook.php and set a breakpoint (or log)Your GLPI setup information
No response
Anything else?
I did some debugging and found the reason for both issues:
unactivate
the respective hook.php is not included like in for exampleactivate
doHook
there is aisPluginActive
condition which prevents thepost_plugin_disable
hook to execute. This is a logical error because the plugin is and can not be active anymore when the post_plugin_disable hook is called.I would be glad if anyone with some more glpi-knowledge could look into this and confirm my thoughts.
The text was updated successfully, but these errors were encountered: