aboutsummaryrefslogtreecommitdiffstats
path: root/bin/process-inactive-accounts
diff options
context:
space:
mode:
Diffstat (limited to 'bin/process-inactive-accounts')
-rwxr-xr-xbin/process-inactive-accounts43
1 files changed, 43 insertions, 0 deletions
diff --git a/bin/process-inactive-accounts b/bin/process-inactive-accounts
new file mode 100755
index 000000000..3df200d3d
--- /dev/null
+++ b/bin/process-inactive-accounts
@@ -0,0 +1,43 @@
+#!/usr/bin/env perl
+
+use v5.14;
+use warnings;
+
+BEGIN {
+ use File::Basename qw(dirname);
+ use File::Spec;
+ my $d = dirname(File::Spec->rel2abs($0));
+ require "$d/../setenv.pl";
+}
+
+use Getopt::Long;
+use FixMyStreet::Script::Inactive;
+use Pod::Usage;
+
+my %h;
+GetOptions(\%h, 'anonymize=i', 'email=i', 'verbose|v', 'help|h', 'dry-run|n');
+pod2usage(0) if $h{help};
+pod2usage(1) if !$h{anonymize};
+pod2usage("Anonymize time must be greater than email time")
+ if $h{email} && $h{email} >= $h{anonymize};
+
+FixMyStreet::Script::Inactive->new(%h)->users;
+
+__END__
+
+=head1 NAME
+
+process-inactive-accounts - deal with anonymizing old inactive accounts
+
+=head1 SYNOPSIS
+
+process-inactive-accounts --anonymize N [--email N]
+
+ Options:
+ --anonymize Anonymize accounts inactive longer than this time (months)
+ --email Email accounts inactive longer than this time (months)
+ --dry-run Don't actually anonymize anything or send any emails
+ --verbose Output as to which users are being affected
+ --help This help message
+
+=cut