3 # Fix the mailing-lists if they have been broken in previous versions
4 # Roland Mas <lolando@debian.org>
9 use File::Temp qw/ :mktemp /;
11 use vars qw/ $dbh $sys_lists_host $sys_dbname $sys_dbuser $sys_dbpasswd $domain_name / ;
17 require ("/etc/gforge/local.pl") ;
18 require("/usr/share/gforge/lib/include.pl"); # Include all the predefined functions
22 $dbh->{AutoCommit} = 0;
23 $dbh->{RaiseError} = 1;
25 my ($query, $sth, @array, @lines, $line) ;
27 $query = "SELECT mail_group_list.group_list_id,
28 mail_group_list.list_name,
30 mail_group_list.password,
31 mail_group_list.description
32 FROM mail_group_list, users
33 WHERE mail_group_list.status = 3
34 AND mail_group_list.list_admin = users.user_id" ; # Status = 3: list already created
35 $sth = $dbh->prepare ($query) ;
37 while (my @myarray = $sth->fetchrow_array ()) {
38 push @lines, \@myarray ;
42 foreach $line (@lines) {
44 my ($group_list_id, $listname, $user_name, $password, $description) ;
48 ($group_list_id, $listname, $user_name, $password, $description)= @array ;
50 $tmp = mktemp ("/tmp/XXXXXX") ;
51 $cmd = "/usr/lib/mailman/bin/config_list -o $tmp $listname" ;
52 #print "cmd = <$cmd>\n" ;
54 open CONFIG, ">>$tmp" ;
55 print CONFIG "description = \"$description\"\n" ;
56 print CONFIG "host_name = '$sys_lists_host'\n" ;
58 $cmd = "/usr/lib/mailman/bin/config_list -i $tmp $listname" ;
59 #print "cmd = <$cmd>\n" ;
63 $cmd= "/usr/lib/mailman/bin/withlist -l -r fix_url $listname -u $sys_lists_host" ;
64 #print "cmd = <$cmd>\n" ;
67 #debug "Rolling back -- nothing should have changed anyway." ;
71 # There should be a commit at the end of every block above.
72 # If there is not, then it might be symptomatic of a problem.
73 # For safety, we roll back.
78 warn "Transaction aborted because $@" ;
79 debug "Transaction aborted because $@" ;
81 debug "Please report this bug on the Debian bug-tracking system." ;
82 debug "Please include the previous messages as well to help debugging." ;