Dont connect hooks twice

This commit is contained in:
Robin Appelman 2014-06-05 21:08:30 +02:00
parent 0b2ae314c7
commit 46f70aabfd
1 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,12 @@ class OC_Hook{
self::$registered[$signalclass][$signalname] = array(); self::$registered[$signalclass][$signalname] = array();
} }
// dont connect hooks twice
foreach (self::$registered[$signalclass][$signalname] as $hook) {
if ($hook['class'] === $slotclass and $hook['name'] === $slotname) {
return false;
}
}
// Connect the hook handler to the requested emitter // Connect the hook handler to the requested emitter
self::$registered[$signalclass][$signalname][] = array( self::$registered[$signalclass][$signalname][] = array(
"class" => $slotclass, "class" => $slotclass,