add log for debug

This commit is contained in:
Tiger Ren 2025-01-01 20:51:41 +08:00
parent 0b1f591174
commit 592d586acb
1 changed files with 5 additions and 5 deletions

View File

@ -25,16 +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); error_log('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'); error_log('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'); error_log('TelegramLinkFixer: Skipping - empty description');
return; return;
} }
@ -42,11 +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)) {
Minz_Log::debug('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink); error_log('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
// $entry->setLink($telegraphLink); // $entry->setLink($telegraphLink);
} }
} else { } else {
Minz_Log::debug('TelegramLinkFixer: No Telegraph link found in description'); error_log('TelegramLinkFixer: No Telegraph link found in description');
} }
} }
} }