3 # svn_dump.pl - script to dump data from the database
4 # inspired from sourceforge scripts
5 # Christian Bayle <bayle@debian.org>
11 require("/usr/share/gforge/lib/include.pl"); # Include all the predefined functions
12 require("/etc/gforge/plugins/$scm/config.pl"); # Include plugin config vars
16 my $scm_file = $file_dir . "/dumps/$scm.dump";
18 if($verbose) {print ("\nConnecting to database");}
22 if($verbose) {print ("\nGetting group list");}
24 # Dump the Groups Table information
26 $query= "SELECT groups.group_id,groups.unix_group_name,groups.status,groups.use_scm,groups.enable_pserver,groups.enable_anonscm FROM groups,group_plugin,plugins WHERE groups.unix_group_name !='' AND groups.group_id=group_plugin.group_id AND group_plugin.plugin_id=plugins.plugin_id AND plugins.plugin_name='".$scm."'";
27 # AND cvs_box=$hostname to be added for multi-cvs server support
29 $c = $dbh->prepare($query);
32 if($verbose) {print ("\nGetting user list per group");}
33 while(my ($group_id, $group_name, $status, $use_scm, $enable_pserver, $enable_anonscm) = $c->fetchrow()) {
35 my $new_query = "SELECT users.user_name AS user_name FROM users,user_group WHERE users.user_id=user_group.user_id AND cvs_flags=1 AND group_id=$group_id";
36 my $d = $dbh->prepare($new_query);
41 while($user_name = $d->fetchrow()) {
42 $user_list .= "$user_name,";
45 $grouplist = "$group_name:$status:$group_id:$use_scm:$enable_pserver:$enable_anonscm:$user_list\n";
48 push @group_array, $grouplist;
51 # Now write out the files (not necessary, but can give info in case of problems)
52 if($verbose) {print ("\nWriting list");}
53 write_array_file($scm_file, @group_array);
54 system("chmod o-r $scm_file");