aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet.pm20
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm2
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm2
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm12
-rw-r--r--perllib/FixMyStreet/Geocode/Bing.pm2
-rw-r--r--perllib/FixMyStreet/SendReport/EastHants.pm2
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm6
-rw-r--r--perllib/FixMyStreet/SendReport/EmptyHomes.pm6
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm1
-rw-r--r--perllib/Open311/PopulateServiceList.pm2
11 files changed, 21 insertions, 36 deletions
diff --git a/perllib/FixMyStreet.pm b/perllib/FixMyStreet.pm
index 3fc067d3e..1a9c8ff60 100644
--- a/perllib/FixMyStreet.pm
+++ b/perllib/FixMyStreet.pm
@@ -95,15 +95,12 @@ sub override_config($&) {
mySociety::MaPit::configure($config->{MAPIT_URL}) if $config->{MAPIT_URL};
- # For historical reasons, we have two ways of asking for config variables.
- # Override them both, I'm sure we'll find time to get rid of one eventually.
- #
- # NB: though we have these two functions, templates tend to use [% c.config %]
+ # NB: though we have this, templates tend to use [% c.config %].
# This overriding happens after $c->config is set, so note that
# FixMyStreet::App->setup_request rewrites $c->config if we are in
# test_mode, so tests should Just Work there too.
- my $override_guard1 = Sub::Override->new(
+ my $override_guard = Sub::Override->new(
"FixMyStreet::config",
sub {
my ($class, $key) = @_;
@@ -113,23 +110,12 @@ sub override_config($&) {
return $orig_config->{$key} if exists $orig_config->{$key};
}
);
- my $override_guard2 = Sub::Override->new(
- "mySociety::Config::get",
- sub ($;$) {
- my ($key, $default) = @_;
- return $config->{$key} if exists $config->{$key};
- my $orig_config = mySociety::Config::load_default();
- return $orig_config->{$key} if exists $orig_config->{$key};
- return $default if @_ == 2;
- }
- );
FixMyStreet::Map::reload_allowed_maps() if $config->{MAP_TYPE};
$code->();
- $override_guard1->restore();
- $override_guard2->restore();
+ $override_guard->restore();
mySociety::MaPit::configure() if $config->{MAPIT_URL};
FixMyStreet::Map::reload_allowed_maps() if $config->{MAP_TYPE};
}
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index b817fe326..586d5e7ae 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -218,7 +218,7 @@ sub query_main : Private {
. ($alert_type->head_table ? $alert_type->head_table . '_id=? and ' : '')
. $alert_type->item_where . ' order by '
. $alert_type->item_order;
- my $rss_limit = mySociety::Config::get('RSS_LIMIT');
+ my $rss_limit = FixMyStreet->config('RSS_LIMIT');
$query .= " limit $rss_limit" unless $c->stash->{type} =~ /^all/;
my $q = $c->model('DB::Alert')->result_source->storage->dbh->prepare($query);
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index 66d8bd472..0fb8c23d0 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -43,7 +43,7 @@ sub problems {
sub base_url {
my $self = shift;
- my $base_url = mySociety::Config::get('BASE_URL');
+ my $base_url = FixMyStreet->config('BASE_URL');
my $u = $self->council_url;
if ( $base_url !~ /$u/ ) {
# council cobrands are not https so transform to http as well
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 5c4511268..2eb6c6fc7 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -628,7 +628,7 @@ sub body {
$body = join( _(' and '),
map {
my $name = $_->name;
- if ($c and mySociety::Config::get('AREA_LINKS_FROM_PROBLEMS')) {
+ if ($c and FixMyStreet->config('AREA_LINKS_FROM_PROBLEMS')) {
'<a href="' . $_->url($c) . '">' . $name . '</a>';
} else {
$name;
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 8e6cc7333..0d7b34daf 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -7,9 +7,9 @@ use warnings;
use CronFns;
use Utils;
-use mySociety::Config;
use mySociety::MaPit;
+use FixMyStreet;
use FixMyStreet::Cobrand;
use FixMyStreet::Email;
use FixMyStreet::SendReport;
@@ -247,7 +247,7 @@ sub send_reports {
# Set up site, language etc.
my ($verbose, $nomail, $debug_mode) = CronFns::options();
- my $base_url = mySociety::Config::get('BASE_URL');
+ my $base_url = FixMyStreet->config('BASE_URL');
my $site = $site_override || CronFns::site($base_url);
my $states = [ 'confirmed', 'fixed' ];
@@ -424,7 +424,7 @@ sub send_reports {
. " ]\n\n";
}
- if (mySociety::Config::get('STAGING_SITE') && !mySociety::Config::get('SEND_REPORTS_ON_STAGING')) {
+ if (FixMyStreet->config('STAGING_SITE') && !FixMyStreet->config('SEND_REPORTS_ON_STAGING')) {
# on a staging server send emails to ourselves rather than the bodies
%reporters = map { $_ => $reporters{$_} } grep { /FixMyStreet::SendReport::(Email|EmptyHomes)/ } keys %reporters;
unless (%reporters) {
@@ -495,7 +495,7 @@ sub send_reports {
send_fail_count => { '>', 0 }
} );
while (my $row = $unsent->next) {
- my $base_url = mySociety::Config::get('BASE_URL');
+ my $base_url = FixMyStreet->config('BASE_URL');
$sending_errors .= "* " . $base_url . "/report/" . $row->id . ", failed "
. $row->send_fail_count . " times, last at " . $row->send_fail_timestamp
. ", reason " . $row->send_fail_reason . "\n";
@@ -520,9 +520,9 @@ sub _send_report_sent_email {
_template_ => $template,
_parameters_ => $h,
To => $row->user->email,
- From => [ mySociety::Config::get('CONTACT_EMAIL'), $cobrand->contact_name ],
+ From => [ FixMyStreet->config('CONTACT_EMAIL'), $cobrand->contact_name ],
},
- mySociety::Config::get('CONTACT_EMAIL'),
+ FixMyStreet->config('CONTACT_EMAIL'),
$nomail,
$cobrand
);
diff --git a/perllib/FixMyStreet/Geocode/Bing.pm b/perllib/FixMyStreet/Geocode/Bing.pm
index d7db10ae6..8cad8be7c 100644
--- a/perllib/FixMyStreet/Geocode/Bing.pm
+++ b/perllib/FixMyStreet/Geocode/Bing.pm
@@ -71,7 +71,7 @@ sub reverse {
my ( $latitude, $longitude, $bing_culture ) = @_;
# Get nearest road-type thing from Bing
- my $key = mySociety::Config::get('BING_MAPS_API_KEY', '');
+ my $key = FixMyStreet->config('BING_MAPS_API_KEY', '');
if ($key) {
my $url = "http://dev.virtualearth.net/REST/v1/Locations/$latitude,$longitude?key=$key";
$url .= '&c=' . $bing_culture if $bing_culture;
diff --git a/perllib/FixMyStreet/SendReport/EastHants.pm b/perllib/FixMyStreet/SendReport/EastHants.pm
index 697519b48..3eb8ffcfa 100644
--- a/perllib/FixMyStreet/SendReport/EastHants.pm
+++ b/perllib/FixMyStreet/SendReport/EastHants.pm
@@ -28,7 +28,7 @@ EOF
}
sub send {
- return if mySociety::Config::get('STAGING_SITE');
+ return if FixMyStreet->config('STAGING_SITE');
my ( $self, $row, $h ) = @_;
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm
index 3e993ecd6..4d2c8bb17 100644
--- a/perllib/FixMyStreet/SendReport/Email.pm
+++ b/perllib/FixMyStreet/SendReport/Email.pm
@@ -75,7 +75,7 @@ sub send {
my $recips = $self->build_recipient_list( $row, $h );
# on a staging server send emails to ourselves rather than the bodies
- if (mySociety::Config::get('STAGING_SITE') && !mySociety::Config::get('SEND_REPORTS_ON_STAGING') && !FixMyStreet->test_mode) {
+ if (FixMyStreet->config('STAGING_SITE') && !FixMyStreet->config('SEND_REPORTS_ON_STAGING') && !FixMyStreet->test_mode) {
$recips = 1;
@{$self->to} = [ $row->user->email, $self->to->[0][1] || $row->name ];
}
@@ -100,13 +100,13 @@ sub send {
if (FixMyStreet::Email::test_dmarc($params->{From}[0])) {
$params->{'Reply-To'} = [ $params->{From} ];
- $params->{From} = [ mySociety::Config::get('CONTACT_EMAIL'), $params->{From}[1] ];
+ $params->{From} = [ FixMyStreet->config('CONTACT_EMAIL'), $params->{From}[1] ];
}
my $result = FixMyStreet::Email::send_cron(
$row->result_source->schema,
$params,
- mySociety::Config::get('CONTACT_EMAIL'),
+ FixMyStreet->config('CONTACT_EMAIL'),
$nomail,
$cobrand
);
diff --git a/perllib/FixMyStreet/SendReport/EmptyHomes.pm b/perllib/FixMyStreet/SendReport/EmptyHomes.pm
index a4cdd3e40..b5faf8ddc 100644
--- a/perllib/FixMyStreet/SendReport/EmptyHomes.pm
+++ b/perllib/FixMyStreet/SendReport/EmptyHomes.pm
@@ -34,11 +34,11 @@ sub build_recipient_list {
my $area_info = mySociety::MaPit::call('area', $body->body_areas->first->area_id);
my $country = $area_info->{country};
if ($country eq 'W') {
- push @{$self->bcc}, 'wales@' . mySociety::Config::get('EMAIL_DOMAIN');
+ push @{$self->bcc}, 'wales@' . FixMyStreet->config('EMAIL_DOMAIN');
} elsif ($country eq 'S') {
- push @{$self->bcc}, 'scotland@' . mySociety::Config::get('EMAIL_DOMAIN');
+ push @{$self->bcc}, 'scotland@' . FixMyStreet->config('EMAIL_DOMAIN');
} else {
- push @{$self->bcc}, 'eha@' . mySociety::Config::get('EMAIL_DOMAIN');
+ push @{$self->bcc}, 'eha@' . FixMyStreet->config('EMAIL_DOMAIN');
}
}
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index 1917c2f58..4844aa2e9 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -5,7 +5,6 @@ use namespace::autoclean;
BEGIN { extends 'FixMyStreet::SendReport'; }
-use mySociety::Config;
use DateTime::Format::W3CDTF;
use Open311;
use Readonly;
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm
index f251606cf..15a827217 100644
--- a/perllib/Open311/PopulateServiceList.pm
+++ b/perllib/Open311/PopulateServiceList.pm
@@ -39,7 +39,7 @@ sub process_body {
unless ( $list && $list->{service} ) {
if ($self->verbose >= 1) {
my $id = $self->_current_body->id;
- my $mapit_url = mySociety::Config::get('MAPIT_URL');
+ my $mapit_url = FixMyStreet->config('MAPIT_URL');
my $areas = join( ",", keys %{$self->_current_body->areas} );
warn "Body $id for areas $areas - $mapit_url/areas/$areas.html - did not return a service list\n";
warn $open311->error;