From e973904765e4efb242d09d3d41d7f9eb0a294424 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 10 Jan 2017 14:58:59 +0000 Subject: Move staging flags to their own config variable. --- perllib/FixMyStreet.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'perllib/FixMyStreet.pm') diff --git a/perllib/FixMyStreet.pm b/perllib/FixMyStreet.pm index 14f3f3607..1f4579293 100644 --- a/perllib/FixMyStreet.pm +++ b/perllib/FixMyStreet.pm @@ -212,4 +212,18 @@ sub set_time_zone { $dt->set_time_zone($tz_f) if $tz_f; } +# Development functions + +sub staging_flag { + my ($cls, $flag, $value) = @_; + $value = 1 unless defined $value; + return unless $cls->config('STAGING_SITE'); + my $flags = $cls->config('STAGING_FLAGS'); + unless ($flags && ref $flags eq 'HASH') { + # Assume all flags 0 if missing + return !$value; + } + return $flags->{$flag} == $value; +} + 1; -- cgit v1.2.3