dump the entry

This commit is contained in:
Tiger Ren 2025-01-06 15:28:24 +08:00
parent 6d24cd0139
commit 842b04328f
1 changed files with 8 additions and 2 deletions

View File

@ -12,9 +12,11 @@ class TelegramLinkFixerExtension extends Minz_Extension
/** /**
* Called automatically at extension load-time. Set up hooks here. * Called automatically at extension load-time. Set up hooks here.
*/ */
#[\Override]
public function init() public function init()
{ {
// Hook into FreshRSS just before each entry is saved to database: // Hook into FreshRSS just before each entry is saved to database:
parent::init();
$this->registerHook('entry_before_insert', array($this, 'fixLink')); $this->registerHook('entry_before_insert', array($this, 'fixLink'));
} }
@ -24,6 +26,9 @@ class TelegramLinkFixerExtension extends Minz_Extension
public function fixLink($entry) public function fixLink($entry)
{ {
try { try {
error_log("dump $entry:");
var_dump($entry);
// Check if it's a telegram link // Check if it's a telegram link
$link = $entry->link(); $link = $entry->link();
error_log('TelegramLinkFixer: Processing entry with link: ' . $link); error_log('TelegramLinkFixer: Processing entry with link: ' . $link);
@ -52,10 +57,11 @@ class TelegramLinkFixerExtension extends Minz_Extension
} else { } else {
error_log('TelegramLinkFixer: No Telegraph link found in content'); error_log('TelegramLinkFixer: No Telegraph link found in content');
} }
return $entry; return $entry;
} catch (Exception $e) { } catch (Exception $e) {
Minz_Log::error('TelegramLinkFixer: Error processing entry: ' . $e->getMessage()); error_log('TelegramLinkFixer: Error processing entry: ' . $e->getMessage());
return $entry; return $entry; // Return the entry even if an exception occurs
} }
} }
} }