From 61ed8355f7deed10d49ec8854f85c3036c759af4 Mon Sep 17 00:00:00 2001 From: SecretR <secretr@e107.org> Date: Fri, 8 Feb 2013 09:15:57 +0200 Subject: [PATCH] Plugin handler - execute_function supports callback data now; current and required version number now sent to the upgrade_required method (plugin setup file) --- e107_handlers/e107_class.php | 2 +- e107_handlers/plugin_class.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 7610b5d0d..332c56890 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -1424,7 +1424,7 @@ class e107 /** * Retrieve plugin handler singleton object - * @return e_ranks + * @return e107plugin */ public static function getPlugin() { diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index ca356acbe..628d4bac2 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -182,7 +182,7 @@ class e107plugin $curVal = floatval($version); $fileVal = floatval($data['@attributes']['version']); - if($ret = $this->execute_function($path, 'upgrade', 'required')) // Check {plugin}_setup.php and run a 'required' method, if true, then update is required. + if($ret = $this->execute_function($path, 'upgrade', 'required', array($this, $curVal, $fileVal))) // Check {plugin}_setup.php and run a 'required' method, if true, then update is required. { if($mode == 'boolean') { @@ -2109,9 +2109,10 @@ class e107plugin * @param object $path [unused] * @param object $what install|uninstall|upgrade * @param object $when pre|post + * @param array $callbackData callback method arguments * @return boolean FALSE */ - function execute_function($path = null, $what = '', $when = '') + function execute_function($path = null, $what = '', $when = '', $callbackData = null) { $mes = eMessage::getInstance(); @@ -2157,6 +2158,7 @@ class e107plugin { $mes->add("Executing setup function <b>".$class_name." :: ".$method_name."()</b>", E_MESSAGE_DEBUG); } + if(null !== $callbackData) return call_user_func_array(array($obj, $method_name), $callbackData); return call_user_func(array($obj, $method_name), $this); } else