From d48d0f740005ea3183752fd3fb40c9fc701b318a Mon Sep 17 00:00:00 2001 From: lonalore Date: Mon, 23 Mar 2015 11:15:13 +0100 Subject: [PATCH 1/2] Issue #936: Event triggering after plugin install/uninstall/upgrade/refresh --- e107_handlers/plugin_class.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 56fd5493a..468c8d823 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -1632,6 +1632,30 @@ class e107plugin } + if ($function == 'install') + { + $event = e107::getEvent(); + $event->trigger('admin_plugin_install', $plug); + } + + if ($function == 'uninstall') + { + $event = e107::getEvent(); + $event->trigger('admin_plugin_uninstall', $plug); + } + + if ($function == 'upgrade') + { + $event = e107::getEvent(); + $event->trigger('admin_plugin_upgrade', $plug); + } + + if ($function == 'refresh') + { + $event = e107::getEvent(); + $event->trigger('admin_plugin_refresh', $plug); + } + } // Placeholder. @@ -2519,6 +2543,10 @@ class e107plugin $text .= "
".LAN_CONFIGURE.""; } + // Event triggering after plugin installation. + $event = e107::getEvent(); + $event->trigger('admin_plugin_install', $plug); + return $text; } From d43d37575997fd7fd8d623005e8694472e727631 Mon Sep 17 00:00:00 2001 From: lonalore Date: Tue, 24 Mar 2015 12:29:26 +0100 Subject: [PATCH 2/2] declaration at the top of method --- e107_handlers/plugin_class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 468c8d823..9a8e4f354 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -1369,6 +1369,7 @@ class e107plugin $pref = e107::getPref(); $sql = e107::getDb(); $mes = e107::getMessage(); + $event = e107::getEvent(); $error = array(); // Array of error messages $canContinue = TRUE; // Clear flag if must abort part way through @@ -1634,25 +1635,21 @@ class e107plugin if ($function == 'install') { - $event = e107::getEvent(); $event->trigger('admin_plugin_install', $plug); } if ($function == 'uninstall') { - $event = e107::getEvent(); $event->trigger('admin_plugin_uninstall', $plug); } if ($function == 'upgrade') { - $event = e107::getEvent(); $event->trigger('admin_plugin_upgrade', $plug); } if ($function == 'refresh') { - $event = e107::getEvent(); $event->trigger('admin_plugin_refresh', $plug); }