aboutsummaryrefslogtreecommitdiffstats
path: root/bin/fetch-comments-24hs
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-10-17 12:52:27 +0100
committerStruan Donald <struan@exo.org.uk>2012-10-17 12:52:27 +0100
commit799ddcad7369bef12ef4a2795cd74787b34bc7ee (patch)
treec92413cf110d6c5b14ec803f0ca12e0905fda05a /bin/fetch-comments-24hs
parent0b29251ad6bd71091bdb314fc7504a1eaaea3d22 (diff)
add script to fetch last 24 hours of updates as a backup and default to last 2 hours in standard script
Diffstat (limited to 'bin/fetch-comments-24hs')
-rw-r--r--bin/fetch-comments-24hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/fetch-comments-24hs b/bin/fetch-comments-24hs
new file mode 100644
index 000000000..b84f09ba7
--- /dev/null
+++ b/bin/fetch-comments-24hs
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use DateTime;
+use DateTime::Format::W3CDTF;
+require 5.8.0;
+
+use FixMyStreet::App;
+use CronFns;
+my ($verbose, $nomail) = CronFns::options();
+
+use Open311;
+use Open311::GetServiceRequestUpdates;
+
+my $dt = DateTime->now();
+my $dt_24hrs_ago = $dt->clone;
+$dt_24hrs_ago->add( hours => -24 );
+
+my $updates = Open311::GetServiceRequestUpdates->new(
+ verbose => 1,
+ start_date => DateTime::Format::W3CDTF->format_datetime( $dt_24hrs_ago ),
+ end_date => DateTime::Format::W3CDTF->format_datetime( $dt )
+);
+
+$updates->fetch;