From 031acde003b85ae34a4996d0c02fdc41ffae5515 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 13 Jun 2018 09:27:02 +0200 Subject: Fix extension hook for updated articles (#1932) * Fix extension hook for updated articles https://github.com/FreshRSS/FreshRSS/issues/1926 * Enable extensions during PubSubHubbub * A little array protection * Changelog 1926 https://github.com/FreshRSS/FreshRSS/issues/1926 https://github.com/FreshRSS/FreshRSS/pull/1932 * Add null check --- app/Controllers/feedController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index ca85e7cb8..ec88156f9 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -351,13 +351,20 @@ class FreshRSS_feed_Controller extends Minz_ActionController { //This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3 $oldGuids[] = $entry->guid(); } else { //This entry already exists but has been updated - //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() . + //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url() . //', old hash ' . $existingHash . ', new hash ' . $entry->hash()); $mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') !== null ? ( $feed->attributes('mark_updated_article_unread') ) : FreshRSS_Context::$user_conf->mark_updated_article_unread; $needFeedCacheRefresh = $mark_updated_article_unread; $entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy. + + $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); + if ($entry === null) { + // An extension has returned a null value, there is nothing to insert. + continue; + } + if (!$entryDAO->inTransaction()) { $entryDAO->beginTransaction(); } -- cgit v1.2.3