aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--index.php1
-rw-r--r--model/Schedule.php9
2 files changed, 10 insertions, 0 deletions
diff --git a/index.php b/index.php
index 1c0df61..35db28f 100644
--- a/index.php
+++ b/index.php
@@ -70,6 +70,7 @@ try {
$route = rtrim($route, '/');
$GLOBALS['forceopen'] = isset($_GET['forceopen']);
+ $GLOBALS['regenschedcache'] = isset($_GET['regenschedcache']) && !isset($_SERVER['HTTP_X_REAL_IP']);
// generic template
$tpl = new PhpTemplate('template/page.phtml');
diff --git a/model/Schedule.php b/model/Schedule.php
index 52eac4e..5419136 100644
--- a/model/Schedule.php
+++ b/model/Schedule.php
@@ -72,6 +72,11 @@ class Schedule
public function getSchedule()
{
+ $cachefile = sprintf('/tmp/getschedule-cache-%s.cache', $this->getConference()->getSlug());
+ if(file_exists($cachefile) && !$GLOBALS['regenschedcache']) {
+ return unserialize(file_get_contents($cachefile));
+ }
+
// download schedule-xml
$schedule = $this->fetchSchedule();
@@ -261,6 +266,10 @@ class Schedule
});
}
+ if($GLOBALS['regenschedcache']) {
+ file_put_contents($cachefile, serialize($program));
+ }
+
return $program;
}