aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorpezholio <pezholio@gmail.com>2017-01-18 17:05:10 +0000
committerDave Arter <davea@mysociety.org>2017-02-15 13:35:57 +0000
commit8e6f6a1818b4f998d48f157387d2314bb8c86f8a (patch)
tree29a0a89f65016cd0fc4900ea7491da67ddd2389a /bin
parent9efe4d14d1415e2fa060891b8be8ffec8b237911 (diff)
[Oxfordshire] Old report archiving script
This script can be used for the bulk closure of old reports that haven't been updated in a long time. Reports that haven't been updated in a *really* long time (since 2014, by default) are simply closed, and those that haven't been updated since 2015 (by default) are closed and an email explaining the closure is sent to the report creator. This script can be used for other cobrands, but they'll need an archive.{txt,html} template in order for the emails to be sent. For mysociety/fixmystreetforcouncils#51
Diffstat (limited to 'bin')
-rwxr-xr-xbin/oxfordshire/archive-old-enquiries29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/oxfordshire/archive-old-enquiries b/bin/oxfordshire/archive-old-enquiries
new file mode 100755
index 000000000..7fe66703a
--- /dev/null
+++ b/bin/oxfordshire/archive-old-enquiries
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+
+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 FixMyStreet::Script::ArchiveOldEnquiries;
+use Getopt::Long::Descriptive;
+
+my ($opts, $usage) = describe_options(
+ '%c %o',
+ ['commit|c', "actually close reports and send emails. Omitting this flag will do a dry-run"],
+ ['body|b=s', "which body ID to close reports for"],
+ ['cobrand=s', "which cobrand template to use for sent emails"],
+ ['closure-cutoff=s', "Anything before this will be closed with no email"],
+ ['email-cutoff=s', "Anything before this will be closed with an email sent to the reporter"],
+ ['limit|l=s', "limit to a certain number of reports/users to be closed"],
+ ['help|h', "print usage message and exit" ],
+);
+print($usage->text), exit if $opts->help;
+
+FixMyStreet::Script::ArchiveOldEnquiries::archive($opts);