add log
This commit is contained in:
parent
b25c6f6402
commit
cd53c164c2
|
|
@ -26,29 +26,29 @@ class TelegramLinkFixerExtension extends Minz_Extension
|
|||
try {
|
||||
// Check if it's a telegram link
|
||||
$link = $entry->link();
|
||||
error_logg('TelegramLinkFixer: Processing entry with link: ' . $link);
|
||||
error_log('TelegramLinkFixer: Processing entry with link: ' . $link);
|
||||
|
||||
if (strpos($link, 't.me') === false) {
|
||||
error_logg('TelegramLinkFixer: Skipping - not a telegram link');
|
||||
error_log('TelegramLinkFixer: Skipping - not a telegram link');
|
||||
return; // skip if not a telegram link
|
||||
}
|
||||
|
||||
// The correct method is content() not description()
|
||||
$description = $entry->content();
|
||||
if (empty($description)) {
|
||||
error_logg('TelegramLinkFixer: Skipping - empty content');
|
||||
error_log('TelegramLinkFixer: Skipping - empty content');
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
|
||||
$telegraphLink = $matches[1];
|
||||
if (!empty($telegraphLink)) {
|
||||
error_logg('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
|
||||
error_log('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
|
||||
$entry->setLink($telegraphLink);
|
||||
error_logg('TelegramLinkFixer: Successfully updated link');
|
||||
error_log('TelegramLinkFixer: Successfully updated link');
|
||||
}
|
||||
} else {
|
||||
error_logg('TelegramLinkFixer: No Telegraph link found in content');
|
||||
error_log('TelegramLinkFixer: No Telegraph link found in content');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Minz_Log::error('TelegramLinkFixer: Error processing entry: ' . $e->getMessage());
|
||||
|
|
|
|||
Loading…
Reference in New Issue