Skip to content

Commit

Permalink
change storage paths according to issue description
Browse files Browse the repository at this point in the history
  • Loading branch information
MaZderMind committed Dec 17, 2016
1 parent 9c7bccc commit 3384e96
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
13 changes: 5 additions & 8 deletions command/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,23 @@
);
}

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)
);
}
}




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)
Expand Down
3 changes: 3 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion model/Relive.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getJsonUrl()

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()
Expand Down
2 changes: 1 addition & 1 deletion model/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function getScheduleUrl()

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()
Expand Down

0 comments on commit 3384e96

Please sign in to comment.