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("/usr/share/gforge/lib/include.pl"); # Include all the predefined functions
21 $dbh->{AutoCommit} = 0;
22 $dbh->{RaiseError} = 1;
24 my ($query, $sth, @array, @lines, $line) ;
26 $query = "SELECT mail_group_list.group_list_id,
27 mail_group_list.list_name,
29 mail_group_list.password,
30 mail_group_list.description
31 FROM mail_group_list, users
32 WHERE mail_group_list.status = 3
33 AND mail_group_list.list_admin = users.user_id" ; # Status = 3: list already created
34 $sth = $dbh->prepare ($query) ;
36 while (my @myarray = $sth->fetchrow_array ()) {
37 push @lines, \@myarray ;
41 foreach $line (@lines) {
43 my ($group_list_id, $listname, $user_name, $password, $description) ;
47 ($group_list_id, $listname, $user_name, $password, $description)= @array ;
49 $tmp = mktemp ("/tmp/XXXXXX") ;
50 $cmd = "/usr/lib/mailman/bin/config_list -o $tmp $listname" ;
51 #print "cmd = <$cmd>\n" ;
53 open CONFIG, ">>$tmp" ;
54 print CONFIG "description = \"$description\"\n" ;
55 print CONFIG "host_name = '$sys_lists_host'\n" ;
57 $cmd = "/usr/lib/mailman/bin/config_list -i $tmp $listname" ;
58 #print "cmd = <$cmd>\n" ;
63 if (&forge_get_config ('use_ssl') eq 'yes') {
64 $urlpattern = 'https://%s/cgi-bin/mailman/';
66 $urlpattern = 'http://%s/cgi-bin/mailman/';
68 $cmd= "/usr/lib/mailman/bin/withlist -l -r fix_url $listname -u $sys_lists_host" ;
69 #print "cmd = <$cmd>\n" ;
72 #debug "Rolling back -- nothing should have changed anyway." ;
76 # There should be a commit at the end of every block above.
77 # If there is not, then it might be symptomatic of a problem.
78 # For safety, we roll back.
83 warn "Transaction aborted because $@" ;
84 debug "Transaction aborted because $@" ;
86 debug "Please report this bug on the Debian bug-tracking system." ;
87 debug "Please include the previous messages as well to help debugging." ;