aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaZderMind2014-12-14 00:53:28 +0100
committerMaZderMind2014-12-14 00:53:28 +0100
commitc9c977461b2fa1cfdbb1285ddea1c56d78439885 (patch)
treefb7bb71e58f2a37f6048fdb87a783cc68199de4e /lib
parent1d40a77dfe6b0100bdd53b2da812a97c9353c7eb (diff)
store a local copy of the schedule in case the source goes down
i head this could possibly happen *gg
Diffstat (limited to 'lib')
-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)