aboutsummaryrefslogtreecommitdiffstats
path: root/bin/send-reports
blob: 9651c271ca2924bd0ddcf4de9c7e97f5501c952c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env perl

# send-reports:
# Send new problem reports to councils
#
# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org

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 Getopt::Long::Descriptive;
use CronFns;

use FixMyStreet;
use FixMyStreet::Script::Reports;

my $site = CronFns::site(FixMyStreet->config('BASE_URL'));
CronFns::language($site);

my ($opts, $usage) = describe_options(
    '%c %o',
    ['verbose|v', 'more verbose output'],
    ['nomail', 'do not send any email, print instead'],
    ['debug', 'always try and send reports (no back-off skipping)'],
    ['help|h', "print usage message and exit" ],
);
$usage->die if $opts->help;

FixMyStreet::Script::Reports::send($opts->verbose, $opts->nomail, $opts->debug);