aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2017-12-20 15:58:51 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-03-15 13:17:18 +0000
commit935f431ee0da77dd26a78b959d3b9afb89665c0f (patch)
tree68b4b80d88cfcd9f2915f091b16927a00f2a0680 /bin
parent40a3bfb7566b02db2eb6019adcbefeaa19ffb42f (diff)
fetch new problems over open311
This enables the display of existing reports from the back end on FMS if the body is configured to do this. Reports will not be created if they are missing an id, a lat or a long, if the lat/long is outside the area covered by the body, if there is already a report with a matching id, or if we can't parse out the request time.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fetch-reports25
-rwxr-xr-xbin/update-schema1
2 files changed, 26 insertions, 0 deletions
diff --git a/bin/fetch-reports b/bin/fetch-reports
new file mode 100755
index 000000000..665b4aff0
--- /dev/null
+++ b/bin/fetch-reports
@@ -0,0 +1,25 @@
+#!/usr/bin/env perl
+#
+# This script utilises the Open311 extension explained at
+# https://github.com/mysociety/FixMyStreet/wiki/Open311-FMS---Proposed-differences-to-Open311
+# to fetch updates on service requests.
+
+use strict;
+use warnings;
+require 5.8.0;
+
+BEGIN {
+ use File::Basename qw(dirname);
+ use File::Spec;
+ my $d = dirname(File::Spec->rel2abs($0));
+ require "$d/../setenv.pl";
+}
+
+use CronFns;
+my ($verbose, $nomail) = CronFns::options();
+
+use Open311::GetServiceRequests;
+
+my $reports = Open311::GetServiceRequests->new( verbose => $verbose );
+
+$reports->fetch;
diff --git a/bin/update-schema b/bin/update-schema
index fea316bd6..d9322d80b 100755
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -212,6 +212,7 @@ else {
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
return 'EMPTY' if ! table_exists('problem');
+ return '0057' if column_exists('body', 'fetch_problems');
return '0056' if column_exists('users', 'email_verified');
return '0055' if column_exists('response_priorities', 'is_default');
return '0054' if table_exists('state');