diff options
author | MaZderMind | 2016-12-17 14:11:47 +0100 |
---|---|---|
committer | MaZderMind | 2016-12-17 14:12:29 +0100 |
commit | 3384e963da66e9089b71c546750c8981be8c6ed8 (patch) | |
tree | 83a452dbcb3aa1716c6a0dd90f99c07f145f4829 /command/download.php | |
parent | 9c7bccc3f2cc226cd5043752403e4c5d39c8b5b5 (diff) |
change storage paths according to issue description
Diffstat (limited to '')
-rw-r--r-- | command/download.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/command/download.php b/command/download.php index 8deb454..17ae7c9 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) |