aboutsummaryrefslogtreecommitdiff
path: root/lib/program.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/program.php')
-rw-r--r--lib/program.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/program.php b/lib/program.php
index 5507442..721abea 100644
--- a/lib/program.php
+++ b/lib/program.php
@@ -3,8 +3,19 @@
function program()
{
$program = array();
- $schedule = simplexml_load_file($GLOBALS['CONFIG']['SCHEDULE']);
+ $schedule = file_get_contents($GLOBALS['CONFIG']['SCHEDULE']);
+ // loading failed, try tmp-file
+ if(!$schedule)
+ $schedule = file_get_contents('/tmp/website-schedule-fallback.xml');
+
+ // failed, too, give up
+ if(!$schedule)
+ return array();
+
+ // save tmp-file (for when uplink goes down or such)
+ file_put_contents('/tmp/website-schedule-fallback.xml', $schedule);
+ $schedule = simplexml_load_string($schedule);
// re-calculate day-ends
// some schedules have long gaps before the first talk or talks that expand beyond the dayend
// (fiffkon, i look at you)