mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 06:34:17 +00:00
store a local copy of the schedule in case the source goes down
i head this could possibly happen *gg
This commit is contained in:
parent
1d40a77dfe
commit
c9c977461b
1 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue