[vhffs-dev] [811] A bit better now

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 811
Author:   gradator
Date:     2007-08-30 00:08:37 +0000 (Thu, 30 Aug 2007)

Log Message:
-----------
A bit better now

Modified Paths:
--------------
    trunk/vhffs-robots/Makefile.am

Added Paths:
-----------
    trunk/vhffs-robots/src/group_getquota.pl
    trunk/vhffs-robots/src/repository_getquota.pl
    trunk/vhffs-robots/src/svn_viewvcconf.pl

Removed Paths:
-------------
    trunk/vhffs-robots/src/create_viewvcconf.pl
    trunk/vhffs-robots/src/group_updatequotaused.pl
    trunk/vhffs-robots/src/group_updatequotausedrepository.pl


Modified: trunk/vhffs-robots/Makefile.am
===================================================================
--- trunk/vhffs-robots/Makefile.am	2007-08-30 00:05:34 UTC (rev 810)
+++ trunk/vhffs-robots/Makefile.am	2007-08-30 00:08:37 UTC (rev 811)
@@ -19,7 +19,6 @@
     misc/vhffs_post_commit.pl
 
 bots_SCRIPTS = \
-	src/create_viewvcconf.pl \
 	src/cvs_create.pl \
 	src/cvs_delete.pl \
 	src/cvs_fixperms.pl \
@@ -29,10 +28,9 @@
 	src/dns_refused.pl \
 	src/group_create.pl \
 	src/group_delete.pl \
+	src/group_getquota.pl \
 	src/group_refused.pl \
 	src/group_setquota.pl \
-	src/group_updatequotaused.pl \
-	src/group_updatequotausedrepository.pl \
 	src/listengine_publicarchives.pl \
 	src/mail_create.pl \
 	src/mail_delete.pl \
@@ -53,6 +51,7 @@
 	src/pgsql_refused.pl \
 	src/repository_create.pl \
 	src/repository_delete.pl \
+	src/repository_getquota.pl \
 	src/repository_refused.pl \
 	src/repository_setquota.pl \
 	src/repository_stats.pl \
@@ -60,6 +59,7 @@
 	src/svn_delete.pl \
 	src/svn_public.pl \
 	src/svn_refused.pl \
+	src/svn_viewvcconf.pl \
 	src/svn_websvn.pl \
 	src/user_create.pl \
 	src/user_delete.pl \

Deleted: trunk/vhffs-robots/src/create_viewvcconf.pl
===================================================================
--- trunk/vhffs-robots/src/create_viewvcconf.pl	2007-08-30 00:05:34 UTC (rev 810)
+++ trunk/vhffs-robots/src/create_viewvcconf.pl	2007-08-30 00:08:37 UTC (rev 811)
@@ -1,96 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Constants;
-use Vhffs::Services::Cvs;
-use Vhffs::Services::Svn;
-use Vhffs::Robots;
-use HTML::Template;
-
-my $sampleconf = "/usr/lib/vhffs/bots/misc/viewvc.conf.tmpl";
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , "viewvcconf" );
-
-my $confdir = $vhffs->get_config->get_datadir . "/conf/";
-mkdir( $confdir ) if( ! -d $confdir );
-
-my $ouputfile = $confdir . "viewvc.conf";
-
-my $cvsroots;
-my $svnroots;
-
-if( $vhffs->get_config->use_cvs == 1 )
-{
-	my $cvss = Vhffs::Services::Cvs::getall( $vhffs , Vhffs::Constants::ACTIVATED );
-	my $cvs;
-
-	foreach $cvs ( @{$cvss} )
-	{
-		if( $cvs->is_public == 1 )
-		{
-			my $cvspath = $cvs->get_cvsroot;
-			$cvspath =~ s/\//_/;
-			$cvsroots .= "  cvs_" . $cvspath . ": " . $cvs->get_dir . ",\n";
-		}
-	}
-}
-
-if( $vhffs->get_config->use_svn == 1 )
-{
-	my $svns = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::ACTIVATED );
-	my $svn;
-
-	foreach $svn ( @{$svns} )
-	{
-		if( $svn->is_public == 1 )
-		{
-			my $svnpath = $svn->get_reponame;
-			$svnpath =~ s/\//_/;
-			$svnroots .= "  svn_" . $svnpath . ": " . $svn->get_dir . ",\n";
-		}
-	}
-}
-
-my $template = new HTML::Template( filename => "$sampleconf" );
-$template->param( CVSROOTS => "cvs_roots = ".$cvsroots ) if ( defined $cvsroots );
-$template->param( SVNROOTS => "svn_roots = ".$svnroots ) if ( defined $svnroots );
-
-open( OUTPUT , ">$ouputfile" );
-print OUTPUT $template->output;
-close( OUTPUT );
-
-Vhffs::Robots::unlock( $vhffs , "viewvcconf" );

Copied: trunk/vhffs-robots/src/group_getquota.pl (from rev 810, trunk/vhffs-robots/src/group_updatequotaused.pl)
===================================================================
--- trunk/vhffs-robots/src/group_getquota.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/group_getquota.pl	2007-08-30 00:08:37 UTC (rev 811)
@@ -0,0 +1,69 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+#3. Neither the name of vhffs nor the names of its contributors 
+#   may be used to endorse or promote products derived from this 
+#   software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+require 5.004;
+use strict;
+use POSIX;
+use locale;
+use Locale::gettext;
+use Quota;
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Group;
+
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , "getquota" );
+
+my $groups = Vhffs::Group::getall( $vhffs , Vhffs::Constants::ACTIVATED );
+my $group;
+my $blocks;
+my $used;
+my $dev = Quota::getqcarg($vhffs->get_config->get_datadir);
+
+foreach $group ( @$groups ) {
+	($blocks,undef,undef,undef,undef,undef,undef,undef) = Quota::query($dev, $group->get_gid, 1);
+    if(defined($blocks)) {
+        $used = ($blocks + 1024 - ($blocks % 1024)) / 1024;
+        if($group->get_quota_used() != $used) {
+            $group->set_quota_used( $used );
+            if( $group->commit > 0 ) {
+    			Vhffs::Robots::vhffs_log( sprintf( "Update quota used for group %s set %s" , $group->get_groupname , $used ) , $vhffs);
+		    }
+	    }   
+    }
+}
+
+Vhffs::Robots::unlock( $vhffs , "getquota" );
+
+exit 0;

Deleted: trunk/vhffs-robots/src/group_updatequotaused.pl
===================================================================
--- trunk/vhffs-robots/src/group_updatequotaused.pl	2007-08-30 00:05:34 UTC (rev 810)
+++ trunk/vhffs-robots/src/group_updatequotaused.pl	2007-08-30 00:08:37 UTC (rev 811)
@@ -1,69 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-require 5.004;
-use strict;
-use POSIX;
-use locale;
-use Locale::gettext;
-use Quota;
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Group;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , "getquota" );
-
-my $groups = Vhffs::Group::getall( $vhffs , Vhffs::Constants::ACTIVATED );
-my $group;
-my $blocks;
-my $used;
-my $dev = Quota::getqcarg($vhffs->get_config->get_datadir);
-
-foreach $group ( @$groups ) {
-	($blocks,undef,undef,undef,undef,undef,undef,undef) = Quota::query($dev, $group->get_gid, 1);
-    if(defined($blocks)) {
-        $used = ($blocks + 1024 - ($blocks % 1024)) / 1024;
-        if($group->get_quota_used() != $used) {
-            $group->set_quota_used( $used );
-            if( $group->commit > 0 ) {
-    			Vhffs::Robots::vhffs_log( sprintf( "Update quota used for group %s set %s" , $group->get_groupname , $used ) , $vhffs);
-		    }
-	    }   
-    }
-}
-
-Vhffs::Robots::unlock( $vhffs , "getquota" );
-
-exit 0;

Deleted: trunk/vhffs-robots/src/group_updatequotausedrepository.pl
===================================================================
--- trunk/vhffs-robots/src/group_updatequotausedrepository.pl	2007-08-30 00:05:34 UTC (rev 810)
+++ trunk/vhffs-robots/src/group_updatequotausedrepository.pl	2007-08-30 00:08:37 UTC (rev 811)
@@ -1,84 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-require 5.004;
-use strict;
-use POSIX;
-use locale;
-use Locale::gettext;
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Group;
-use Vhffs::Services::Repository;
-use Quota;
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , "getquotarepository" );
-
-my $groups = Vhffs::Group::getall( $vhffs , Vhffs::Constants::ACTIVATED );
-my $group;
-my $blocks;
-my $inodes;
-my $repos;
-my $repo;
-my $su;
-my $dev = Quota::getqcarg($vhffs->get_config->get_datadir."/".Vhffs::Constants::REPOSITORYDIR);
-
-foreach $group ( @{$groups} )
-{
-	if( defined $group )
-	{
-		$repos = Vhffs::Services::Repository::getall_per_group( $vhffs, $group);
-		if( defined $repos )
-		{
-			($blocks,undef,undef,undef,$inodes,undef,undef,undef) = Quota::query($dev, $group->get_gid, 1);
-			if ( defined $blocks )
-			{
-				$su = ($blocks+1024-($blocks%1024))/1024;
-
-				# set this space usedto all repositories of this group
-				foreach $repo ( @{$repos} )
-				{
-					$repo->set_quota_used( $su );
-					$repo->commit;
-				}
-
-				Vhffs::Robots::vhffs_log( sprintf( "Update quota used for repositories of group %s to %s MB" , $group->get_groupname , $su ) , $vhffs);
-			}
-		}
-	}
-}
-
-Vhffs::Robots::unlock( $vhffs , "getquotarepository" );
-
-exit 0;

Copied: trunk/vhffs-robots/src/repository_getquota.pl (from rev 810, trunk/vhffs-robots/src/group_updatequotausedrepository.pl)
===================================================================
--- trunk/vhffs-robots/src/repository_getquota.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/repository_getquota.pl	2007-08-30 00:08:37 UTC (rev 811)
@@ -0,0 +1,84 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+#3. Neither the name of vhffs nor the names of its contributors 
+#   may be used to endorse or promote products derived from this 
+#   software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+require 5.004;
+use strict;
+use POSIX;
+use locale;
+use Locale::gettext;
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Group;
+use Vhffs::Services::Repository;
+use Quota;
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , "getquotarepository" );
+
+my $groups = Vhffs::Group::getall( $vhffs , Vhffs::Constants::ACTIVATED );
+my $group;
+my $blocks;
+my $inodes;
+my $repos;
+my $repo;
+my $su;
+my $dev = Quota::getqcarg($vhffs->get_config->get_datadir."/".Vhffs::Constants::REPOSITORYDIR);
+
+foreach $group ( @{$groups} )
+{
+	if( defined $group )
+	{
+		$repos = Vhffs::Services::Repository::getall_per_group( $vhffs, $group);
+		if( defined $repos )
+		{
+			($blocks,undef,undef,undef,$inodes,undef,undef,undef) = Quota::query($dev, $group->get_gid, 1);
+			if ( defined $blocks )
+			{
+				$su = ($blocks+1024-($blocks%1024))/1024;
+
+				# set this space usedto all repositories of this group
+				foreach $repo ( @{$repos} )
+				{
+					$repo->set_quota_used( $su );
+					$repo->commit;
+				}
+
+				Vhffs::Robots::vhffs_log( sprintf( "Update quota used for repositories of group %s to %s MB" , $group->get_groupname , $su ) , $vhffs);
+			}
+		}
+	}
+}
+
+Vhffs::Robots::unlock( $vhffs , "getquotarepository" );
+
+exit 0;

Copied: trunk/vhffs-robots/src/svn_viewvcconf.pl (from rev 798, trunk/vhffs-robots/src/create_viewvcconf.pl)
===================================================================
--- trunk/vhffs-robots/src/svn_viewvcconf.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/svn_viewvcconf.pl	2007-08-30 00:08:37 UTC (rev 811)
@@ -0,0 +1,96 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+#3. Neither the name of vhffs nor the names of its contributors 
+#   may be used to endorse or promote products derived from this 
+#   software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Constants;
+use Vhffs::Services::Cvs;
+use Vhffs::Services::Svn;
+use Vhffs::Robots;
+use HTML::Template;
+
+my $sampleconf = "/usr/lib/vhffs/bots/misc/viewvc.conf.tmpl";
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , "viewvcconf" );
+
+my $confdir = $vhffs->get_config->get_datadir . "/conf/";
+mkdir( $confdir ) if( ! -d $confdir );
+
+my $ouputfile = $confdir . "viewvc.conf";
+
+my $cvsroots;
+my $svnroots;
+
+if( $vhffs->get_config->use_cvs == 1 )
+{
+	my $cvss = Vhffs::Services::Cvs::getall( $vhffs , Vhffs::Constants::ACTIVATED );
+	my $cvs;
+
+	foreach $cvs ( @{$cvss} )
+	{
+		if( $cvs->is_public == 1 )
+		{
+			my $cvspath = $cvs->get_cvsroot;
+			$cvspath =~ s/\//_/;
+			$cvsroots .= "  cvs_" . $cvspath . ": " . $cvs->get_dir . ",\n";
+		}
+	}
+}
+
+if( $vhffs->get_config->use_svn == 1 )
+{
+	my $svns = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::ACTIVATED );
+	my $svn;
+
+	foreach $svn ( @{$svns} )
+	{
+		if( $svn->is_public == 1 )
+		{
+			my $svnpath = $svn->get_reponame;
+			$svnpath =~ s/\//_/;
+			$svnroots .= "  svn_" . $svnpath . ": " . $svn->get_dir . ",\n";
+		}
+	}
+}
+
+my $template = new HTML::Template( filename => "$sampleconf" );
+$template->param( CVSROOTS => "cvs_roots = ".$cvsroots ) if ( defined $cvsroots );
+$template->param( SVNROOTS => "svn_roots = ".$svnroots ) if ( defined $svnroots );
+
+open( OUTPUT , ">$ouputfile" );
+print OUTPUT $template->output;
+close( OUTPUT );
+
+Vhffs::Robots::unlock( $vhffs , "viewvcconf" );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/