mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
* (fix) remove hooks from db on plugin deinstall
This commit is contained in:
parent
ab69b182e6
commit
0d37e07a0d
@ -138,7 +138,7 @@ class Plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function uninstall($plugin_name) {
|
public static function uninstall($plugin_name) {
|
||||||
global $cache;
|
global $cache, $db;
|
||||||
|
|
||||||
$filename = BASE . 'plugins/' . $plugin_name . '.json';
|
$filename = BASE . 'plugins/' . $plugin_name . '.json';
|
||||||
if(!file_exists($filename)) {
|
if(!file_exists($filename)) {
|
||||||
@ -166,6 +166,20 @@ class Plugins {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($plugin_info['hooks'])) {
|
||||||
|
foreach ($plugin_info['hooks'] as $_name => $info) {
|
||||||
|
if (defined('HOOK_'. $info['type'])) {
|
||||||
|
$hook = constant('HOOK_'. $info['type']);
|
||||||
|
$query = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'hooks` WHERE `name` = ' . $db->quote($_name) . ';');
|
||||||
|
if ($query->rowCount() == 1) { // found something
|
||||||
|
$query = $query->fetch();
|
||||||
|
$db->delete(TABLE_PREFIX . 'hooks', array('id' => (int)$query['id']));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
self::$warnings[] = 'Unknown event type: ' . $info['type'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($success) {
|
if($success) {
|
||||||
if($cache->enabled()) {
|
if($cache->enabled()) {
|
||||||
$cache->delete('templates');
|
$cache->delete('templates');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user