diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-01-10 14:58:59 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-01-10 17:16:22 +0000 |
commit | e973904765e4efb242d09d3d41d7f9eb0a294424 (patch) | |
tree | 9d19715611556f243bff86105a97289ee36fa31b /perllib/FixMyStreet.pm | |
parent | d5641749504a8eb9295f95bac412cb3737256476 (diff) |
Move staging flags to their own config variable.
Diffstat (limited to 'perllib/FixMyStreet.pm')
-rw-r--r-- | perllib/FixMyStreet.pm | 14 |
1 files changed, 14 insertions, 0 deletions
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; |