2008-08-18 Roland Mas <lolando@debian.org>
+ * common/include/PluginManager.class.php: Allow return values for
+ plugins (patch #2689 by Alain Peyrat).
+
* plugins/scmcvs/cronjobs/history_parse.php: Fixed DB commit
underflow (patch #2207 by Yann Dirson).
var $plugins_objects ;
var $plugins_to_hooks ;
var $hooks_to_plugins ;
+ var $returned_value = array();
/**
* PluginManager() - constructor
*
* @param hookname - name of the hook
* @param params - array of extra parameters
+ *
+ * @return boolean, true if all returned true.
*/
function RunHooks ($hookname, & $params) {
+ $result = true;
if (isset($this->hooks_to_plugins[$hookname])) {
$p_list = $this->hooks_to_plugins[$hookname];
foreach ($p_list as $p_name) {
$p_obj = $this->plugins_objects[$p_name] ;
- $p_obj->CallHook ($hookname, $params) ;
+ $returned = $p_obj->CallHook ($hookname, $params);
+ $this->returned_value[$hookname] = $returned;
+ $result = $result && $returned ;
}
}
- return true ;
+
+ // Return true only if all the plugins have returned true.
+ return $result;
+ }
+
+ function getReturnedValue($hookname) {
+ return $this->returned_value[$hookname];
}
/**