From 284878f0f9917b55359cd464b86508cacc472653 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 11 Dec 2016 21:46:01 +0100 Subject: add cache-file getters and download preparations --- model/Schedule.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'model/Schedule.php') diff --git a/model/Schedule.php b/model/Schedule.php index eb9fe05..4032ecb 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -265,11 +265,16 @@ class Schedule return ((int)$parts[0] * 60 + (int)$parts[1]) * 60; } - private function getScheduleUrl() + public function getScheduleUrl() { return $this->getConference()->get('SCHEDULE.URL'); } + public function getScheduleCache() + { + return sprintf('/tmp/schedule-cache-%s', $this->getConference()->getSlug()); + } + public function getScheduleToRoomSlugMapping() { $mapping = array(); -- cgit v1.2.3 From 3384e963da66e9089b71c546750c8981be8c6ed8 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 17 Dec 2016 14:11:47 +0100 Subject: change storage paths according to issue description --- model/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model/Schedule.php') diff --git a/model/Schedule.php b/model/Schedule.php index 4032ecb..6536864 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -272,7 +272,7 @@ class Schedule public function getScheduleCache() { - return sprintf('/tmp/schedule-cache-%s', $this->getConference()->getSlug()); + return sprintf('/tmp/schedule-cache-%s.xml', $this->getConference()->getSlug()); } public function getScheduleToRoomSlugMapping() -- cgit v1.2.3 From da739f3b60a30d5dd5c7877742f8b5c292f25f46 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 18 Dec 2016 10:37:10 +0100 Subject: use the new cache-files for viewing --- model/Schedule.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'model/Schedule.php') diff --git a/model/Schedule.php b/model/Schedule.php index 6536864..b54709e 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -36,17 +36,10 @@ class Schedule private function fetchSchedule() { - $opts = array( - 'http' => array( - 'timeout' => 2, - 'user_agent' => 'C3VOC Universal Streaming-Website Backend @ '.$_SERVER['HTTP_HOST'], - ) - ); - $context = stream_context_create($opts); - $schedule = file_get_contents($this->getScheduleUrl(), false, $context); + $schedule = file_get_contents($this->getScheduleCache()); if(!$schedule) - throw new ScheduleException("Error Downloading Schedule from ".$this->getConference()->getScheduleUrl()); + throw new ScheduleException("Error Loading Schedule from ".$this->getScheduleCache()); return simplexml_load_string($schedule); } -- cgit v1.2.3