From 6f6fc8b2d15b253bd455661a38d41ece11a547c0 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 10 Aug 2016 12:42:24 +0100 Subject: 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. --- perllib/FixMyStreet/Geocode/Zurich.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'perllib/FixMyStreet/Geocode/Zurich.pm') 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'); } -- cgit v1.2.3