change storage paths according to issue description

This commit is contained in:
MaZderMind 2016-12-17 14:11:47 +01:00
parent 9c7bccc3f2
commit 3384e963da
4 changed files with 10 additions and 10 deletions

View file

@ -77,13 +77,13 @@ foreach ($conferences as $conference)
); );
} }
foreach($conference->getExtraFiles() as $file) foreach($conference->getExtraFiles() as $filename => $url)
{ {
download( download(
'extra-file', 'extra-file',
$conference, $conference,
$file, $url,
get_file_cache($conference, $file) 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); return joinpath([$GLOBALS['BASEDIR'], 'configs/conferences', $conference->getSlug(), $filename]);
$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));
} }
function download($what, $conference, $url, $cache) function download($what, $conference, $url, $cache)

View file

@ -3,6 +3,9 @@
if(!ini_get('short_open_tag')) if(!ini_get('short_open_tag'))
die("`short_open_tag = On` is required\n"); die("`short_open_tag = On` is required\n");
$GLOBALS['BASEDIR'] = dirname(__FILE__);
chdir($GLOBALS['BASEDIR']);
require_once('config.php'); require_once('config.php');
require_once('lib/helper.php'); require_once('lib/helper.php');

View file

@ -26,7 +26,7 @@ class Relive
public function getJsonCache() 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() public function getTalks()

View file

@ -272,7 +272,7 @@ class Schedule
public function getScheduleCache() 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() public function getScheduleToRoomSlugMapping()