mirror of
https://github.com/slawkens/myaac.git
synced 2026-04-12 21:43:31 +02:00
Fix: Clear hooks on plugin uninstall
Fixes error with gesior-shop-system clear-cache.php being called, despite it's removed
This commit is contained in:
@@ -14,6 +14,26 @@ class Hooks
|
|||||||
self::$_hooks[$hook->type()][] = $hook;
|
self::$_hooks[$hook->type()][] = $hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function unregister($name, $type, $file): void
|
||||||
|
{
|
||||||
|
if (is_string($type)) {
|
||||||
|
$type = constant($type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset(self::$_hooks[$type])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(self::$_hooks[$type] as $id => $hook) {
|
||||||
|
if($name == $hook->name()
|
||||||
|
&& $type == $hook->type()
|
||||||
|
&& $file == $hook->file()
|
||||||
|
) {
|
||||||
|
unset(self::$_hooks[$type][$id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function trigger($type, $params = []): bool
|
public function trigger($type, $params = []): bool
|
||||||
{
|
{
|
||||||
$ret = true;
|
$ret = true;
|
||||||
|
|||||||
@@ -868,6 +868,11 @@ class Plugins {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $hooks;
|
||||||
|
foreach($plugin_info['hooks'] ?? [] as $name => $info) {
|
||||||
|
$hooks->unregister($name, $info['type'], $info['file']);
|
||||||
|
}
|
||||||
|
|
||||||
clearCache();
|
clearCache();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user