[Bps-public-commit] r16265 - RT-Extension-rt_cpan_org/bin

ruz at bestpractical.com ruz at bestpractical.com
Thu Oct 9 23:31:29 EDT 2008


Author: ruz
Date: Thu Oct  9 23:31:29 2008
New Revision: 16265

Added:
   RT-Extension-rt_cpan_org/bin/rt-cpan-email-addresses   (contents, props changed)

Log:
* add script that prints queues' addresses

Added: RT-Extension-rt_cpan_org/bin/rt-cpan-email-addresses
==============================================================================
--- (empty file)
+++ RT-Extension-rt_cpan_org/bin/rt-cpan-email-addresses	Thu Oct  9 23:31:29 2008
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+eval { require RT; 1 } or do {
+    print STDERR "$@\n\nusage: perl -I /opt/rt3/local/lib -I/opt/rt3/lib $0 > results.tsv\n";
+    exit 1;
+};
+
+RT::LoadConfig();
+RT::Init();
+
+{ my $ttt = $RT::Handle; } # stop warning
+my $dbh = $RT::Handle->dbh;
+$dbh->{RaiseError} = 1;
+
+# XXX: we don't filter disabled queue as we want to leave historical notes
+my $query = q{
+    SELECT DISTINCT address FROM (
+        SELECT q.CommentAddress AS address FROM Queues q WHERE q.Disabled = 0
+        UNION ALL
+        SELECT q.CorrespondAddress AS address FROM Queues q WHERE q.Disabled = 0
+    ) AS addresses
+};
+my $sth = $dbh->prepare($query);
+$sth->execute;
+
+while (($_) = $sth->fetchrow_array) {
+    s/\s+//g;
+    next unless defined && length;
+    print $_, "\n";
+}
+exit 0;



More information about the Bps-public-commit mailing list