mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-23 19:48:34 -04:00
Add entry_before_update and entry_before_add hooks (#7977)
Discussion: https://github.com/FreshRSS/FreshRSS/discussions/7973 Changes proposed in this pull request: - Add new extension hook "entry_before_add" - Add new extension hook "entry_before_update" How to test the feature manually: 1. Create extension that uses the hooks and confirm they are invoked correctly. Extension to use for testing https://github.com/rnkln/freshrss-xExtension-Discord/pull/2
This commit is contained in:
1 parent
055342118f
commit
d670bf1e72
5 files changed
+43
No files matched your search
@@ -639,6 +639,12 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
|
||||
// If the entry has changed, there is a good chance for the full content to have changed as well.
|
||||
$entry->loadCompleteContent(true);
|
||||
|
||||
$entry = Minz_ExtensionManager::callHook('entry_before_update', $entry);
|
||||
if (!($entry instanceof FreshRSS_Entry)) {
|
||||
// An extension has returned a null value, there is nothing to insert.
|
||||
continue;
|
||||
}
|
||||
|
||||
$entryDAO->updateEntry($entry->toArray());
|
||||
}
|
||||
} else {
|
||||
@@ -672,6 +678,12 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
|
||||
$feed->pubSubHubbubError(true);
|
||||
}
|
||||
|
||||
$entry = Minz_ExtensionManager::callHook('entry_before_add', $entry);
|
||||
if (!($entry instanceof FreshRSS_Entry)) {
|
||||
// An extension has returned a null value, there is nothing to insert.
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($entryDAO->addEntry($entry->toArray(), true)) {
|
||||
$nbNewArticles++;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user