diff options
-rw-r--r-- | Zotlabs/Extend/Hook.php | 21 | ||||
-rw-r--r-- | version.inc | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php index edfacfa3b..d95defc43 100644 --- a/Zotlabs/Extend/Hook.php +++ b/Zotlabs/Extend/Hook.php @@ -20,6 +20,15 @@ class Hook { if($r) return true; + // To aid in upgrade and transition, remove old settings for any registered hooks that match in all respects except + // for priority or hook_version + + $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `function` = '%s'", + dbesc($hook), + dbesc($file), + dbesc($function), + ); + $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )", dbesc($hook), dbesc($file), @@ -46,6 +55,18 @@ class Hook { return $r; } + // unregister all hooks with this file component. + // Useful for addon upgrades where you want to clean out old interfaces. + + static public function unregister_by_file($file) { + + $r = q("DELETE FROM hook WHERE `file` = '%s' ", + dbesc($file), + ); + + return $r; + } + /** * @brief Inserts a hook into a page request. diff --git a/version.inc b/version.inc index 0b94407ab..f116462c5 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2016-04-27.1379H +2016-04-28.1380H |