Catch errors in calendar fetching
This commit is contained in:
parent
0adc7964e0
commit
44924cf4ca
@ -148,8 +148,12 @@ $ical = new ICal(options: [
|
|||||||
'defaultWeekStart' => 'MO',
|
'defaultWeekStart' => 'MO',
|
||||||
'filterDaysBefore' => '1',
|
'filterDaysBefore' => '1',
|
||||||
]);
|
]);
|
||||||
$ical->initUrl(ICAL_URL, userAgent: 'dorf.jetzt', acceptLanguage: 'de');
|
try {
|
||||||
$events = $ical->eventsFromInterval('2 week') or [];
|
$ical->initUrl(ICAL_URL, userAgent: 'dorf.jetzt', acceptLanguage: 'de');
|
||||||
|
$events = $ical->eventsFromInterval('2 week');
|
||||||
|
} catch (\Exception $e){
|
||||||
|
$events = [];
|
||||||
|
}
|
||||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
$locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
$locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||||
setlocale(LC_TIME, $locale);
|
setlocale(LC_TIME, $locale);
|
||||||
|
Loading…
Reference in New Issue
Block a user