diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-08-10 12:42:24 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-08-10 12:42:24 +0100 |
commit | 6f6fc8b2d15b253bd455661a38d41ece11a547c0 (patch) | |
tree | 77bddd693a6de069e67c9a8eabad7b78931067ae /perllib/FixMyStreet/Geocode | |
parent | e5d85c495f28be97b8f94487dee26646dcd13ebb (diff) |
Make UPLOAD_DIR/GEO_CACHE relative to project root
If they are absolute already, do nothing.
Switch a couple of uses to Path::Tiny as well.
Diffstat (limited to 'perllib/FixMyStreet/Geocode')
-rw-r--r-- | perllib/FixMyStreet/Geocode/Zurich.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Geocode/Zurich.pm b/perllib/FixMyStreet/Geocode/Zurich.pm index 671da9722..c7bd9e9d9 100644 --- a/perllib/FixMyStreet/Geocode/Zurich.pm +++ b/perllib/FixMyStreet/Geocode/Zurich.pm @@ -12,8 +12,8 @@ package FixMyStreet::Geocode::Zurich; use strict; use Digest::MD5 qw(md5_hex); -use File::Path (); use Geo::Coordinates::CH1903Plus; +use Path::Tiny; use Storable; use Utils; @@ -64,8 +64,8 @@ sub string { setup_soap(); - my $cache_dir = FixMyStreet->config('GEO_CACHE') . 'zurich/'; - my $cache_file = $cache_dir . md5_hex($s); + my $cache_dir = path(FixMyStreet->config('GEO_CACHE'), 'zurich')->absolute(FixMyStreet->path_to()); + my $cache_file = $cache_dir->child(md5_hex($s)); my $result; if (-s $cache_file && -M $cache_file <= 7 && !FixMyStreet->config('STAGING_SITE')) { $result = retrieve($cache_file); @@ -80,7 +80,7 @@ sub string { return { error => 'The geocoder appears to be down.' }; } $result = $result->result; - File::Path::mkpath($cache_dir); + $cache_dir->mkpath; store $result, $cache_file if $result && !FixMyStreet->config('STAGING_SITE'); } |