From 53955264441e178afd894791de734189ed13fb78 Mon Sep 17 00:00:00 2001 From: dim0x69 Date: Mon, 27 Nov 2017 11:46:46 +0100 Subject: [PATCH 1/2] add HOOK_UNSUBSCRIBE_FEED --- classes/pluginhost.php | 1 + classes/pref/feeds.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 533e7ee9..f56343c5 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -56,6 +56,7 @@ class PluginHost { const HOOK_FORMAT_ARTICLE_CDM = 35; const HOOK_FEED_BASIC_INFO = 36; const HOOK_SEND_LOCAL_FILE = 37; + const HOOK_UNSUBSCRIBE_FEED = 38; const KIND_ALL = 1; const KIND_SYSTEM = 2; diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index a86a1af9..fcbc0f8c 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1740,6 +1740,10 @@ class Pref_Feeds extends Handler_Protected { static function remove_feed($id, $owner_uid) { + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { + $line = $p->hook_unsubscribe_feed($id, $owner_uid); + } + if ($id > 0) { /* save starred articles in Archived feed */ @@ -1969,4 +1973,4 @@ class Pref_Feeds extends Handler_Protected { return $url_path; } -} \ No newline at end of file +} From e58a14de724da8f110525ba4faf5ecf8f006b3f5 Mon Sep 17 00:00:00 2001 From: dim0x69 Date: Mon, 11 Dec 2017 09:41:45 +0000 Subject: [PATCH 2/2] Check return value from Plugins --- classes/pref/feeds.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100755 => 100644 classes/pref/feeds.php diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php old mode 100755 new mode 100644 index fcbc0f8c..2a9c57e7 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1739,9 +1739,13 @@ class Pref_Feeds extends Handler_Protected { } static function remove_feed($id, $owner_uid) { + $debug = isset($_REQUEST["debug"]); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { - $line = $p->hook_unsubscribe_feed($id, $owner_uid); + if( ! $p->hook_unsubscribe_feed($id, $owner_uid)){ + if($debug) _debug("Feed not removed due to Error in Plugin. (HOOK_UNSUBSCRIBE_FEED)"); + return; + } } if ($id > 0) {