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
|
// Look specifically for Telegraph links
|
||||||
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
|
error_log('TelegramLinkFixer: Looking for Telegraph link in description: ' . $description);
|
||||||
$telegraphLink = $matches[1];
|
try {
|
||||||
if (!empty($telegraphLink)) {
|
if (preg_match('/<a[^>]*?href="(https:\/\/telegra\.ph\/[^"]+)"[^>]*>Telegraph<\/a>/i', $description, $matches)) {
|
||||||
error_log('TelegramLinkFixer: Found Telegraph link: ' . $telegraphLink);
|
$telegraphLink = $matches[1];
|
||||||
// $entry->setLink($telegraphLink);
|
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 {
|
} catch (Exception $e) {
|
||||||
error_log('TelegramLinkFixer: No Telegraph link found in description');
|
error_log('TelegramLinkFixer: Error processing entry: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue