3 # TODO : document what this script is doing
8 use vars qw/$dbh $ifile $ofile @ilist %hash $key $val $cur $line $dbh $sys_dbname $sys_dbuser $sys_dbpasswd $token/ ;
10 require ("/usr/share/gforge/lib/include.pl") ;
16 $ifile = '/etc/gforge/templates/httpd.vhosts' ;
17 $ofile = '/var/lib/gforge/etc/templates/httpd.vhosts' ;
20 or die "Can't open input file '$ifile'" ;
24 open (OFILE, "> $ofile")
25 or die "Can't open output file '$ofile'" ;
27 my $query = "select vh.vhost_name, vh.docdir, vh.cgidir from prweb_vhost vh, groups g where g.status = 'A' and vh.group_id = g.group_id order by vh.vhost_name";
28 my $c = $dbh->prepare($query);
31 while(my ($vhost_name, $docdir, $cgidir) = $c->fetchrow()) {
33 $hash{vhost_name} = $vhost_name ;
34 $hash{docdir} = $docdir ;
35 $hash{cgidir} = $cgidir ;
37 foreach my $k (qw/groupdir_prefix log_path/) {
38 $hash{$k} = &forge_get_config ($k) ;
41 foreach my $tmpl_line (@ilist) {
42 my $line = $tmpl_line ;
44 foreach $cur (keys %hash) {
46 $line =~ s/$token/$hash{$cur}/g ;
48 print OFILE "$line\n";