add log and try catch
This commit is contained in:
parent
592d586acb
commit
410ba6f6ca
|
|
@ -39,14 +39,24 @@ class TelegramLinkFixerExtension extends Minz_Extension
|
|||
}
|
||||
|
||||
// Look specifically for Telegraph links
|
||||
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
|
||||
$telegraphLink = $matches[1];
|
||||
if (!empty($telegraphLink)) {
|
||||
error_log('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
|
||||
// $entry->setLink($telegraphLink);
|
||||
error_log('TelegramLinkFixer: Looking for Telegraph link in description: ' . $description);
|
||||
try {
|
||||
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
|
||||
$telegraphLink = $matches[1];
|
||||
if (!empty($telegraphLink)) {
|
||||
Minz_Log::debug('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
|
||||
try {
|
||||
$entry->setLink($telegraphLink);
|
||||
error_log('TelegramLinkFixer: Successfully updated link');
|
||||
} catch (Exception $e) {
|
||||
error_log('TelegramLinkFixer: Failed to set link: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error_log('TelegramLinkFixer: No Telegraph link found in description');
|
||||
}
|
||||
} else {
|
||||
error_log('TelegramLinkFixer: No Telegraph link found in description');
|
||||
} catch (Exception $e) {
|
||||
error_log('TelegramLinkFixer: Error processing entry: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue