5 # The following exit codes are defined and MUST BE CONSISTENT with the
6 # error codes the library uses:
7 $MR_DBMS_ERR = 47836421;
9 $ENV{PATH} = "/bin:/usr/bin:/sbin:/usr/sbin";
11 $outdir = '/moira/dcm/confluence';
16 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
19 $sth0 = $dbh->prepare("SELECT l.list_id, m.name " .
20 "FROM list l, machine m, serverhosts sh " .
21 "WHERE sh.value3 = l.name AND sh.service = 'CONFLUENCE' " .
22 "AND m.mach_id = sh.mach_id") || exit $MR_DBMS_ERR;
25 while (($root_list_id, $hostname) = $sth0->fetchrow_array) {
26 open(OUT, ">$outdir/$hostname");
28 $sth = $dbh->prepare("SELECT l.name, l.gid FROM list l, imembers i " .
29 "WHERE i.list_id = " . $dbh->quote($root_list_id) .
30 "AND i.member_type = 'LIST' " .
31 "AND i.member_id = l.list_id AND i.direct = 1 " .
32 "AND l.grouplist = 1 ORDER BY l.name") || exit $MR_DBMS_ERR;
35 while (($name, $gid) = $sth->fetchrow_array) {
36 $sth2 = $dbh->prepare("SELECT UNIQUE i.member_type, i.member_id " .
37 "FROM imembers i, list l " .
38 "WHERE l.name = " . $dbh->quote($name) .
39 "AND i.list_id = l.list_id " .
40 "AND (i.member_type = 'USER' " .
41 "OR i.member_type = 'STRING')") ||
50 while (($type, $id) = $sth2->fetchrow_array) {
51 if ($type eq "USER") {
52 ($member) = $dbh->selectrow_array("SELECT login FROM users " .
56 $member = $member . "\@mit.edu";
58 elsif ($type eq "STRING") {
59 ($member) = $dbh->selectrow_array("SELECT string " .
61 "WHERE string_id = " .
65 $row = "$maybecomma$member";