aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-03-15 13:57:05 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-03-15 13:57:05 +0000
commit7c62e5da36f84b156dbbce331da7ca3f7961f27f (patch)
tree8bf57268431b3db5cc300dd59102a80b3244a2c6 /perllib/FixMyStreet/App.pm
parent86414debecd82fb66a03dc360944afc3ae4be3d6 (diff)
Do upload_dir check on start up, not each report.
If we're chugging through a list of reports, this save on a lot of pointless statting of the upload directory which we know is there.
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r--perllib/FixMyStreet/App.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 2fc560bc8..9660d327a 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -11,7 +11,7 @@ use FixMyStreet::Map;
use FixMyStreet::Email;
use Utils;
-use Path::Class;
+use Path::Tiny 'path';
use URI;
use URI::QueryParam;
@@ -103,6 +103,13 @@ after 'prepare_headers' => sub {
__PACKAGE__->log->disable('debug') #
unless __PACKAGE__->debug;
+# Check upload_dir
+my $cache_dir = path(FixMyStreet->config('UPLOAD_DIR'))->absolute(FixMyStreet->path_to());
+$cache_dir->mkpath;
+unless ( -d $cache_dir && -w $cache_dir ) {
+ warn "\x1b[31mCan't find/write to photo cache directory '$cache_dir'\x1b[0m\n";
+}
+
=head1 NAME
FixMyStreet::App - Catalyst based application