add some logs

This commit is contained in:
Tiger Ren 2025-01-01 20:46:47 +08:00
parent d64462b008
commit 0b1f591174
1 changed files with 8 additions and 1 deletions

View File

@ -25,12 +25,16 @@ class TelegramLinkFixerExtension extends Minz_Extension
{ {
// Check if it's a telegram link // Check if it's a telegram link
$link = $entry->link(); $link = $entry->link();
Minz_Log::debug('TelegramLinkFixer: Processing entry with link: ' . $link);
if (strpos($link, 't.me') === false) { if (strpos($link, 't.me') === false) {
Minz_Log::debug('TelegramLinkFixer: Skipping - not a telegram link');
return; // skip if not a telegram link return; // skip if not a telegram link
} }
$description = $entry->description(); $description = $entry->description();
if (empty($description)) { if (empty($description)) {
Minz_Log::debug('TelegramLinkFixer: Skipping - empty description');
return; return;
} }
@ -38,8 +42,11 @@ class TelegramLinkFixerExtension extends Minz_Extension
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) { if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
$telegraphLink = $matches[1]; $telegraphLink = $matches[1];
if (!empty($telegraphLink)) { if (!empty($telegraphLink)) {
$entry->_link($telegraphLink); Minz_Log::debug('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
// $entry->setLink($telegraphLink);
} }
} else {
Minz_Log::debug('TelegramLinkFixer: No Telegraph link found in description');
} }
} }
} }