$result = true;
foreach($exts as $i => $ext) {
- if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i))) {
- if (!$ext['active'])
- $activated = activate_hooks($ext['package'], $comp);
- else
- $activated = hook_invoke($ext['package'], check_value('Active'.$i) ?
- 'activate_extension':'deactivate_extension', $comp, false);
+ if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i)))
+ {
+ $activated = activate_hooks($ext['package'], $comp, !$ext['active']); // change active state
+
if ($activated !== null)
$result &= $activated;
if ($activated || ($activated === null))
Non active hooks are not included in $Hooks array, so we can use special function to
activate.
*/
-function activate_hooks($ext, $comp)
+function activate_hooks($ext, $comp, $on=true)
{
global $Hooks;
}
if (!$hooks)
return false;
- else
+ elseif ($on)
return $hooks->activate_extension($comp, false);
+ else
+ return $hooks->deactivate_extension($comp, false);
}
/*
Calls hook $method defined in extension $ext (if any)