From 3384e963da66e9089b71c546750c8981be8c6ed8 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 17 Dec 2016 14:11:47 +0100 Subject: [PATCH] change storage paths according to issue description --- command/download.php | 13 +++++-------- index.php | 3 +++ model/Relive.php | 2 +- model/Schedule.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/command/download.php b/command/download.php index 8deb454f..17ae7c9e 100644 --- a/command/download.php +++ b/command/download.php @@ -77,13 +77,13 @@ foreach ($conferences as $conference) ); } - foreach($conference->getExtraFiles() as $file) + foreach($conference->getExtraFiles() as $filename => $url) { download( 'extra-file', $conference, - $file, - get_file_cache($conference, $file) + $url, + get_file_cache($conference, $filename) ); } } @@ -91,12 +91,9 @@ foreach ($conferences as $conference) -function get_file_cache($conference, $url) +function get_file_cache($conference, $filename) { - $info = parse_url($url); - $host = trim(preg_replace('/[^a-z0-9]/i', '_', $info['host']), '_'); - $path = trim(preg_replace('/[^a-z0-9]/i', '_', $info['path']), '_'); - return sprintf('/tmp/file-cache-%s_%s_%s-%s', $conference->getSlug(), $host, $path, md5($url)); + return joinpath([$GLOBALS['BASEDIR'], 'configs/conferences', $conference->getSlug(), $filename]); } function download($what, $conference, $url, $cache) diff --git a/index.php b/index.php index 9b4689cc..ca0a6d44 100644 --- a/index.php +++ b/index.php @@ -3,6 +3,9 @@ if(!ini_get('short_open_tag')) die("`short_open_tag = On` is required\n"); +$GLOBALS['BASEDIR'] = dirname(__FILE__); +chdir($GLOBALS['BASEDIR']); + require_once('config.php'); require_once('lib/helper.php'); diff --git a/model/Relive.php b/model/Relive.php index 5676b625..1e8266a6 100644 --- a/model/Relive.php +++ b/model/Relive.php @@ -26,7 +26,7 @@ class Relive public function getJsonCache() { - return sprintf('/tmp/relive-cache-%s', $this->getConference()->getSlug()); + return sprintf('/tmp/relive-cache-%s.json', $this->getConference()->getSlug()); } public function getTalks() diff --git a/model/Schedule.php b/model/Schedule.php index 4032ecb5..65368645 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()