mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-04-16 12:27:20 -04:00
Add a first draft for hooks
- New Extension->registerHook($hook_name, $hook_function) method to register a new hook - Only one hook works for the moment: entry_before_insert - ExtensionManager::callHook will need to evolve based on future hooks See https://github.com/FreshRSS/FreshRSS/issues/252
This commit is contained in:
@@ -329,9 +329,16 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
$id = min(time(), $entry_date) . uSecString();
|
||||
}
|
||||
|
||||
$entry->_id($id);
|
||||
$entry->_isRead($is_read);
|
||||
|
||||
$entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry);
|
||||
if (is_null($entry)) {
|
||||
// An extension has returned a null value, there is nothing to insert.
|
||||
continue;
|
||||
}
|
||||
|
||||
$values = $entry->toArray();
|
||||
$values['id'] = $id;
|
||||
$values['is_read'] = $is_read;
|
||||
$entryDAO->addEntry($values, $prepared_statement);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user