[vhffs-dev] [975] Add GIT support to VHFFS (thanks for jd who made 95% of this patch... |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 975
Author: gradator
Date: 2007-10-11 15:17:52 +0000 (Thu, 11 Oct 2007)
Log Message:
-----------
Add GIT support to VHFFS (thanks for jd who made 95% of this patch... without installing VHFFS... impressive... and me for full debugging :p)
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Constants.pm
trunk/vhffs-api/src/Vhffs/Functions.pm
trunk/vhffs-api/src/Vhffs/Makefile.am
trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
trunk/vhffs-api/src/Vhffs/Panel/Main.pm
trunk/vhffs-api/src/Vhffs/Services.pm
trunk/vhffs-backend/conf/vhffs.conf.dist.in
trunk/vhffs-backend/src/pgsql/initdb.sql.in
trunk/vhffs-compat/4.0.sql.in
trunk/vhffs-panel/Makefile.am
trunk/vhffs-panel/admin/stats.pl
trunk/vhffs-panel/templates/Makefile.am
trunk/vhffs-panel/themes/vhffs/main.css
trunk/vhffs-public/group.pl
trunk/vhffs-public/templates/Makefile.am
trunk/vhffs-public/templates/group.tmpl
trunk/vhffs-public/themes/vhffs/main.css
trunk/vhffs-robots/Makefile.am
trunk/vhffs-shells/tuxshell.c
trunk/vhffs-tests/conf/vhffs.conf
trunk/vhffs-tests/src/Makefile.am
trunk/vhffs-tests/src/Stats.pl
Added Paths:
-----------
trunk/vhffs-api/src/Vhffs/Panel/Git.pm
trunk/vhffs-api/src/Vhffs/Robots/Git.pm
trunk/vhffs-api/src/Vhffs/Services/Git.pm
trunk/vhffs-panel/admin/git/
trunk/vhffs-panel/admin/git/index.pl
trunk/vhffs-panel/admin/git/list.pl
trunk/vhffs-panel/admin/git/search.pl
trunk/vhffs-panel/git/
trunk/vhffs-panel/git/create.pl
trunk/vhffs-panel/git/delete.pl
trunk/vhffs-panel/git/index.pl
trunk/vhffs-panel/git/prefs.pl
trunk/vhffs-panel/git/prefs_save.pl
trunk/vhffs-panel/templates/admin/git/
trunk/vhffs-panel/templates/admin/git/part-modo.tmpl
trunk/vhffs-panel/templates/admin/git/part.tmpl
trunk/vhffs-panel/templates/admin/git/search.tmpl
trunk/vhffs-panel/templates/git/
trunk/vhffs-panel/templates/git/create.tmpl
trunk/vhffs-panel/templates/git/prefs.tmpl
trunk/vhffs-panel/templates/git/user_part.tmpl
trunk/vhffs-panel/themes/vhffs/images/git.png
trunk/vhffs-panel/themes/vhffs/images/gitentry.png
trunk/vhffs-public/templates/misc/git-part.tmpl
trunk/vhffs-robots/src/git_create.pl
trunk/vhffs-robots/src/git_delete.pl
trunk/vhffs-robots/src/git_public.pl
trunk/vhffs-tests/src/Services/Git.pl
Modified: trunk/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Constants.pm 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-api/src/Vhffs/Constants.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -70,6 +70,7 @@
TYPE_PGSQL => 31,
TYPE_CVS => 40,
TYPE_SVN => 41,
+ TYPE_GIT => 42,
TYPE_DNS => 50,
TYPE_MAIL => 60,
TYPE_ML => 61,
Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -53,6 +53,8 @@
my $password;
srand(time ^ $$);
+# TODO: move those tables to Constants
+
my @STATUS_STRINGS;
$STATUS_STRINGS[Vhffs::Constants::WAITING_FOR_VALIDATION] = 'Waiting for validation';
$STATUS_STRINGS[Vhffs::Constants::VALIDATION_REFUSED] = 'Validation refused';
@@ -77,6 +79,7 @@
$TYPES_STRINGS[Vhffs::Constants::TYPE_PGSQL] = 'PgSQL DB';
$TYPES_STRINGS[Vhffs::Constants::TYPE_CVS] = 'CVS Repository';
$TYPES_STRINGS[Vhffs::Constants::TYPE_SVN] = 'SVN Repository';
+$TYPES_STRINGS[Vhffs::Constants::TYPE_GIT] = 'GIT Repository';
$TYPES_STRINGS[Vhffs::Constants::TYPE_DNS] = 'Domain Name';
$TYPES_STRINGS[Vhffs::Constants::TYPE_MAIL] = 'Mail Domain';
$TYPES_STRINGS[Vhffs::Constants::TYPE_ML] = 'Mailing List';
Modified: trunk/vhffs-api/src/Vhffs/Makefile.am
===================================================================
--- trunk/vhffs-api/src/Vhffs/Makefile.am 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-api/src/Vhffs/Makefile.am 2007-10-11 15:17:52 UTC (rev 975)
@@ -35,6 +35,7 @@
Panel/Pgsql.pm \
Panel/Repository.pm \
Panel/Svn.pm \
+ Panel/Git.pm \
Panel/User.pm \
Panel/Web.pm \
Panel/Template.pm \
@@ -45,6 +46,7 @@
Robots/Pgsql.pm \
Robots/Repository.pm \
Robots/Svn.pm \
+ Robots/Git.pm \
Robots/User.pm \
Robots/Web.pm \
Services/Cvs.pm \
@@ -57,7 +59,8 @@
Services/Mysql.pm \
Services/Pgsql.pm \
Services/Repository.pm \
- Services/Svn.pm
+ Services/Svn.pm \
+ Services/Git.pm
# Define the substitution we need to point perl script at correct location
do_sed = $(SED) --in-place \
Modified: trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/ObjectFactory.pm 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-api/src/Vhffs/ObjectFactory.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -61,6 +61,7 @@
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_PGSQL] = 'Vhffs::Services::Pgsql';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_CVS] = 'Vhffs::Services::Cvs';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_SVN] = 'Vhffs::Services::Svn';
+$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_GIT] = 'Vhffs::Services::Git';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_DNS] = 'Vhffs::Services::DNS';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_MAIL] = 'Vhffs::Services::Mail';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_ML] = 'Vhffs::Services::MailingList';
Added: trunk/vhffs-api/src/Vhffs/Panel/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Git.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Panel/Git.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,129 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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.
+
+
+package Vhffs::Panel::Git;
+
+use DBI;
+use POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use strict;
+use Vhffs::User;
+use Vhffs::Main;
+use Vhffs::Acl;
+use Vhffs::Services::Git;
+use Vhffs::Panel::Main;
+use Vhffs::Constants;
+use Vhffs::Functions;
+
+
+=pod
+
+=head2 getall_per_group
+
+ $git = Vhffs::Panel::Git::getall_per_group($vhffs, $gid);
+
+Returns an array of hashrefs (oid, displayname, active, state (localized string)) of all git repos owned by
+a given group.
+
+=cut
+
+
+sub getall_per_group
+{
+ my ( $main, $gid ) = @_;
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT s.object_id AS oid, s.reponame AS displayname, o.state FROM vhffs_git s INNER JOIN vhffs_object o ON s.object_id = o.object_id WHERE o.owner_gid = ? ORDER BY s.reponame';
+ my $sth = $dbh->prepare($sql) or return -1;
+ $sth->execute($gid) or return -2;
+ my $git = [];
+ while(my $s = $sth->fetchrow_hashref) {
+ $s->{active} = ($s->{state} == Vhffs::Constants::ACTIVATED);
+ $s->{refused} = ($s->{state} == Vhffs::Constants::VALIDATION_REFUSED);
+ $s->{state} = Vhffs::Functions::status_string_from_status_id($s->{state});
+ push @$git, $s;
+ }
+ return $git;
+}
+
+sub search {
+ my ($main, $name) = @_;
+
+ my $sql;
+ my @params;
+ my $gits = [];
+
+ if( defined $name ) {
+ $sql = 'SELECT s.reponame AS gitroot, g.groupname, o.state, s.object_id AS oid FROM vhffs_git s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE s.reponame LIKE ?';
+ push(@params, '%'.$name.'%');
+ } else {
+ $sql = 'SELECT s.reponame AS gitroot, g.groupname, o.state, s.object_id AS oid FROM vhffs_git s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
+ }
+
+ my $dbh = $main->get_db_object();
+ my $sth = $dbh->prepare($sql) or return undef;
+
+ return undef unless($sth->execute(@params));
+
+ while(my $s = $sth->fetchrow_hashref('NAME_lc')) {
+ $s->{state} = Vhffs::Functions::status_string_from_status_id($s->{state});
+ push(@$gits, $s);
+ }
+
+ return $gits;
+}
+
+
+
+sub create_git
+{
+ my ($main, $repo, $description, $user, $group) = @_;
+
+ return -1 unless( defined $user );
+ return -2 unless( defined $group );
+
+ my $git = Vhffs::Services::Git::create( $main, $repo, $description, $user, $group );
+
+ return -1 unless( defined $git );
+
+ return ( -3 ) if ( Vhffs::Acl::add_acl( $user , $git , Vhffs::Constants::ACL_DELETE , $main ) < 0 );
+ return ( -3 ) if( Vhffs::Acl::add_acl( $group , $git , Vhffs::Constants::ACL_VIEW , $main ) < 0 );
+
+ return $git;
+}
+
+1;
Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -30,6 +30,7 @@
use Vhffs::Panel::Pgsql;
use Vhffs::Panel::Repository;
use Vhffs::Panel::Svn;
+use Vhffs::Panel::Git;
use Vhffs::Panel::Web;
=pod
@@ -606,6 +607,11 @@
$services_list .= $panel->create_service_index('svn', $svn)->output;
}
+ if($config->get_service_availability('git')) {
+ my $git = Vhffs::Panel::Git::getall_per_group( $vhffs, $gid );
+ $services_list .= $panel->create_service_index('git', $git)->output;
+ }
+
if($config->get_service_availability('mailinglist')) {
my $ml = Vhffs::Panel::MailingList::getall_per_group( $vhffs, $gid );
$services_list .= $panel->create_service_index('mailinglist', $ml)->output;
@@ -798,6 +804,7 @@
pgsql => 'PostgreSQL DBs',
repository => 'Download repositories',
svn => 'SVN repositories',
+ git => 'Git repositories',
web => 'Webareas',
);
Added: trunk/vhffs-api/src/Vhffs/Robots/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Git.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Robots/Git.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,117 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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.
+
+
+package Vhffs::Robots::Git;
+
+use Vhffs::Services::Git;
+use Vhffs::Constants;
+use Vhffs::Functions;
+
+sub create_repo
+{
+ my( $main , $git ) = @_;
+
+
+ my $dir;
+ my $dir2;
+ my $apache_file;
+ my $user_file;
+
+ if( defined $git )
+ {
+ $dir = $git->get_dir;
+
+ if( $git->get_status == Vhffs::Constants::WAITING_FOR_CREATION )
+ {
+ my $ok = 1;
+
+ if( ! -e $dir ) {
+ Vhffs::Functions::create_dir( $dir ) if( ! -d $dir );
+ $git->add_history("Ok, robots find the empty directory and will create git repository");
+ system("cd $dir && git --bare init > /dev/null");
+
+ Vhffs::Functions::chmod_recur( $dir , 0664 , 02775 );
+ Vhffs::Functions::change_owner_recur( $dir , $git->get_owner_uid , $git->get_owner_gid );
+
+ # .'/hooks' directory must be owned by root to prevent abuse of servers
+ Vhffs::Functions::chmod_recur( $dir.'/hooks' , 0644 , 0755 );
+ Vhffs::Functions::change_owner_recur( $dir.'/hooks' , 0 , 0 );
+
+ $git->add_history("The Robots created the git repository");
+ } else {
+ $ok = 0;
+ #TODO support syslog
+ $git->set_status( Vhffs::Constants::CREATING_ERROR );
+ $git->commit();
+ $git->add_history("Error, directory of this git repository already exists! Administrators must fix the problem.");
+ }
+ if( $ok == 1 ) {
+ $git->set_status( Vhffs::Constants::ACTIVATED );
+
+ if( $git->commit < 0 ) {
+ $git->add_history("Cannot commit changes on the object!");
+ } else {
+ $git->add_history("Git repository is now active");
+ }
+ } else {
+ $git->add_history("Object is not created, problem while creating it");
+ }
+ }
+ }
+}
+
+
+
+
+sub delete_repo
+{
+ my $main = shift;
+ my $git = shift;
+
+ my $dir;
+ my $dir2;
+
+ if( defined $git ) {
+ $dir = $git->get_dir;
+ system("rm -rf $dir 2>/dev/null");
+ $git->delete;
+ } else {
+ return -1;
+ }
+
+ return 1;
+}
+
+
+1;
+
Added: trunk/vhffs-api/src/Vhffs/Services/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Git.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Services/Git.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,263 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright 2007 © Julien Danjou <julien@xxxxxxxxxxx>
+# 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.
+
+# This file is a part of VHFFS4 Hosting Platform
+# Please respect the licence of this file and the whole software
+
+package Vhffs::Services::Git;
+
+use base qw(Vhffs::Object);
+use Vhffs::Group;
+use strict;
+use DBI;
+
+sub check_name($) {
+ my $name = shift;
+ return ($name =~ /^[a-z0-9]+\/[a-z0-9]{3,64}$/);
+}
+
+sub delete
+{
+ my $self = shift;
+ my $query;
+ my $request;
+
+ $query = "DELETE FROM vhffs_git WHERE object_id='".$self->{'object_id'}."'";
+ $request = $self->{'db'}->prepare($query);
+ $request->execute or return -1;
+
+ return -1 if( $self->SUPER::delete < 0 );
+}
+
+sub create
+{
+ my ($main, $rname, $description, $user, $group) = @_;
+
+ return undef unless(defined($user) && defined($group));
+ return undef unless(check_name($rname));
+
+ my $git;
+
+ my $dbh = $main->get_db_object();
+ local $dbh->{RaiseError} = 1;
+ local $dbh->{PrintError} = 0;
+ $dbh->begin_work;
+
+ eval {
+ my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_GIT);
+
+ die('Unable to create parent object') unless(defined $parent);
+
+ my $sql = 'INSERT INTO vhffs_git(reponame, public, ml_name, object_id) VALUES(?, 1, \'\', ?)';
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($rname, $parent->get_oid) or return undef;
+
+ $dbh->commit;
+ $git = get_by_reponame($main, $rname);
+ };
+
+ if($@) {
+ warn "Unable to create git repository $rname: $@\n";
+ $dbh->rollback;
+ }
+
+ return $git;
+}
+
+sub get_by_reponame($$) {
+ my ($main, $reponame) = @_;
+ my @params;
+
+ my $sql = 'SELECT s.git_id, s.reponame, o.owner_uid, o.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_git s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.reponame = ?';
+
+ my $dbh = $main->get_db_object();
+
+ return undef unless(@params = $dbh->selectrow_array($sql, undef, $reponame));
+
+ return _new Vhffs::Services::Git($main, @params);
+
+}
+
+=head2 fill_object
+
+See C<Vhffs::Object::fill_object>.
+
+=cut
+
+sub fill_object {
+ my ($class, $obj) = @_;
+ my $sql = q{SELECT git_id, reponame, public, ml_name FROM vhffs_git
+ WHERE object_id = ?};
+ return $class->SUPER::_fill_object($obj, $sql);
+}
+
+sub _new
+{
+ my ($class, $main, $git_id, $reponame, $owner_uid, $owner_gid, $public, $ml_name, $oid, $date_creation, $description, $state) = @_;
+
+ my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, '', $state, Vhffs::Constants::TYPE_GIT);
+ return undef unless(defined $self);
+
+ $self->{git_id} = $git_id;
+ $self->{reponame} = $reponame;
+ $self->{public} = $public;
+ $self->{ml_name} = $ml_name;
+
+ return $self;
+}
+
+sub commit
+{
+ my $self = shift;
+
+ my $query = "UPDATE vhffs_git SET public= '".$self->{'public'}."' WHERE git_id=$self->{'git_id'}";
+ my $request = $self->{'db'}->prepare($query);
+ $request->execute;
+
+ $self->SUPER::commit;
+}
+
+sub commit_option
+{
+ my $self = shift;
+
+ my $query = "UPDATE vhffs_git SET ml_name= '".$self->{'ml_name'}."' WHERE git_id=$self->{'git_id'}";
+ my $request = $self->{'db'}->prepare($query);
+ $request->execute;
+
+ $self->SUPER::commit;
+}
+
+sub set_public
+{
+ my $self = shift;
+ $self->{'public'} = 1;
+}
+
+sub set_private
+{
+ my $self = shift;
+ $self->{'public'} = 0;
+}
+
+sub is_public
+{
+ my $self = shift;
+
+ return -1 if( ! defined $self->{'public'} );
+
+ if( $self->{'public'} == 1 ) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub get_reponame
+{
+ my $self = shift;
+ return $self->{'reponame'};
+}
+
+sub get_label
+{
+ my $self = shift;
+ return $self->{reponame};
+}
+
+sub getall
+{
+ my ($vhffs, $state, $name, $group) = @_;
+
+ my $git = [];
+ my @params;
+
+ my $sql = 'SELECT s.git_id, s.reponame, o.owner_uid, o.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_git s, vhffs_object o WHERE o.object_id = s.object_id';
+
+
+ if(defined $state) {
+ $sql .= ' AND o.state = ?';
+ push(@params, $state);
+ }
+ if(defined $name) {
+ $sql .= ' AND s.name = ?';
+ push(@params, $name);
+ }
+ if(defined($group)) {
+ $sql .= ' AND o.owner_gid = ?';
+ push(@params, $group->get_gid);
+ }
+ $sql .= ' ORDER BY s.reponame';
+
+ my $dbh = $vhffs->get_db_object();
+
+ my $sth = $dbh->prepare($sql);
+ $sth->execute(@params) or die($sql) ; #return undef;
+
+ while(my $s = $sth->fetchrow_arrayref()) {
+ push(@$git, _new Vhffs::Services::Git($vhffs, @$s));
+ }
+ return $git;
+}
+
+sub getall_by_group
+{
+ my ($vhffs, $group) = @_;
+
+ my $git = [];
+ my @params;
+
+ return undef unless( defined $group );
+
+ my $sql = 'SELECT s.git_id, s.reponame, o.owner_uid, o.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_git s INNER
+ JOIN vhffs_object o ON o.object_id = s.object_id WHERE o.owner_gid = ? ORDER BY s.reponame';
+
+ my $dbh = $vhffs->get_db_object();
+
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($group->get_gid) or return undef;
+
+ while(my $s = $sth->fetchrow_arrayref()) {
+ push(@$git, _new Vhffs::Services::Git($vhffs, @$s));
+ }
+ return $git;
+}
+
+sub get_dir
+{
+ my $self = shift;
+ return undef if( ! defined $self );
+
+ return( $self->{'main'}->get_config->get_datadir . "/git/gitroot/" . $self->get_reponame );
+}
+
+1;
Modified: trunk/vhffs-api/src/Vhffs/Services.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services.pm 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-api/src/Vhffs/Services.pm 2007-10-11 15:17:52 UTC (rev 975)
@@ -40,5 +40,6 @@
use Vhffs::Services::Pgsql;
use Vhffs::Services::Repository;
use Vhffs::Services::Svn;
+use Vhffs::Services::Git;
1;
Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in 2007-10-11 15:17:52 UTC (rev 975)
@@ -325,6 +325,22 @@
url_doc = http://help.myhoster.net/svn
</svn>
+ # Configuration for git
+ <git>
+ # Use this module or not
+ activate = no
+
+ # URL to the gitweb
+ # the url scheme is gitweb_url/git_$group_$gitname/ , change the code or modify the software used
+ gitweb_url = "http://gitweb.hoster"
+
+ # From: of emails sent by svn commit notifier
+ notify_from = git@xxxxxxxxx
+
+ # URL to the documentation (optional)
+ url_doc = http://help.myhoster.net/git
+ </git>
+
# Configuration for mail service
<mail>
# Use this module or not
Modified: trunk/vhffs-backend/src/pgsql/initdb.sql.in
===================================================================
--- trunk/vhffs-backend/src/pgsql/initdb.sql.in 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-backend/src/pgsql/initdb.sql.in 2007-10-11 15:17:52 UTC (rev 975)
@@ -257,6 +257,16 @@
CONSTRAINT vhffs_svn_pkey PRIMARY KEY( svn_id )
) WITH OIDS;
+CREATE TABLE vhffs_git
+(
+ git_id SERIAL,
+ reponame varchar NOT NULL,
+ public int4 NOT NULL,
+ ml_name varchar,
+ object_id int4 NOT NULL,
+ CONSTRAINT vhffs_git_pkey PRIMARY KEY( git_id )
+) WITH OIDS;
+
CREATE TABLE vhffs_user_group
(
uid int4 NOT NULL,
@@ -278,6 +288,7 @@
ALTER TABLE vhffs_pgsql ADD CONSTRAINT vhffs_pgsql_unique_dbuser UNIQUE (dbuser);
ALTER TABLE vhffs_repository ADD CONSTRAINT vhffs_repository_unique_name UNIQUE (name);
ALTER TABLE vhffs_svn ADD CONSTRAINT vhffs_svn_unique_reponame UNIQUE (reponame);
+ALTER TABLE vhffs_git ADD CONSTRAINT vhffs_git_unique_reponame UNIQUE (reponame);
ALTER TABLE vhffs_dns ADD CONSTRAINT vhffs_dns_unique_domain UNIQUE (domain);
ALTER TABLE vhffs_ml ADD CONSTRAINT vhffs_ml_unique_address UNIQUE (local_part, domain);
ALTER TABLE vhffs_ml_subscribers ADD CONSTRAINT vhffs_ml_subscribers_member_list UNIQUE (ml_id, member);
@@ -294,6 +305,8 @@
CREATE INDEX idx_vhffs_cvs_public ON vhffs_cvs(public);
-- vhffs_svn.public may be used in where clause to display public svn
CREATE INDEX idx_vhffs_svn_public ON vhffs_svn(public);
+-- vhffs_git.public may be used in where clause to display public git
+CREATE INDEX idx_vhffs_git_public ON vhffs_git(public);
-- vhffs_ml.open_archive may be used in where clause to select on public ml
CREATE INDEX idx_vhffs_ml_open_archive ON vhffs_ml(open_archive);
-- vhffs_object.owner_uid and owner_gid is used a lot in where clauses
@@ -322,6 +335,7 @@
CREATE INDEX idx_vhffs_pgsql_object_id ON vhffs_pgsql(object_id);
CREATE INDEX idx_vhffs_repository_object_id ON vhffs_repository(object_id);
CREATE INDEX idx_vhffs_svn_object_id ON vhffs_svn(object_id);
+CREATE INDEX idx_vhffs_git_object_id ON vhffs_git(object_id);
-- add index on dates, it is used to search old object, ...
CREATE INDEX idx_vhffs_object_date_creation ON vhffs_object(date_creation);
CREATE INDEX idx_vhffs_history_date ON vhffs_history(date);
@@ -369,6 +383,8 @@
ALTER TABLE vhffs_svn ADD CONSTRAINT fk_vhffs_svn_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+ALTER TABLE vhffs_git ADD CONSTRAINT fk_vhffs_git_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
ALTER TABLE vhffs_users ADD CONSTRAINT fk_vhffs_users_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object (object_id) ON DELETE CASCADE;
ALTER TABLE vhffs_user_group ADD CONSTRAINT fk_vhffs_user_group_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON DELETE CASCADE;
Modified: trunk/vhffs-compat/4.0.sql.in
===================================================================
--- trunk/vhffs-compat/4.0.sql.in 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-compat/4.0.sql.in 2007-10-11 15:17:52 UTC (rev 975)
@@ -361,3 +361,15 @@
-- add lastloginpanel to vhffs_users
ALTER TABLE vhffs_users ADD COLUMN lastloginpanel int8;
+
+-- add vhffs_git table
+CREATE TABLE vhffs_git
+(
+ git_id SERIAL,
+ reponame varchar NOT NULL,
+ public int4 NOT NULL,
+ ml_name varchar,
+ object_id int4 NOT NULL,
+ CONSTRAINT vhffs_git_pkey PRIMARY KEY( git_id )
+) WITH OIDS;
+
Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-panel/Makefile.am 2007-10-11 15:17:52 UTC (rev 975)
@@ -70,6 +70,9 @@
admin/svn/index.pl \
admin/svn/list.pl \
admin/svn/search.pl \
+ admin/git/index.pl \
+ admin/git/list.pl \
+ admin/git/search.pl \
admin/user/edit_note.pl \
admin/user/edit_submit.pl \
admin/user/edit.pl \
@@ -142,6 +145,11 @@
svn/index.pl \
svn/prefs_save.pl \
svn/prefs.pl \
+ git/create.pl \
+ git/delete.pl \
+ git/index.pl \
+ git/prefs_save.pl \
+ git/prefs.pl \
user/delete.pl \
user/prefs.pl \
web/create.pl \
@@ -209,6 +217,8 @@
themes/vhffs/images/repositoryentry.png \
themes/vhffs/images/repository.png \
themes/vhffs/images/svnentry.png \
+ themes/vhffs/images/gitentry.png \
+ themes/vhffs/images/git.png \
themes/vhffs/images/tab.png \
themes/vhffs/images/tip.png \
themes/vhffs/images/userentry.png \
Added: trunk/vhffs-panel/admin/git/index.pl
===================================================================
--- trunk/vhffs-panel/admin/git/index.pl (rev 0)
+++ trunk/vhffs-panel/admin/git/index.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,61 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use strict;
+
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Admin;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+$panel->check_admin;
+
+my $templatedir = $panel->{templatedir};
+
+my $template = new HTML::Template(filename => $templatedir.'/panel/admin/index.tmpl');
+
+$panel->set_title(gettext('GIT repositories\' administration'));
+
+$template->param( CATEGORIES => [ Vhffs::Panel::Admin::get_git_category ] );
+
+$panel->build( $template );
+$panel->display;
Property changes on: trunk/vhffs-panel/admin/git/index.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-panel/admin/git/list.pl
===================================================================
--- trunk/vhffs-panel/admin/git/list.pl (rev 0)
+++ trunk/vhffs-panel/admin/git/list.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,99 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 HTML::Template;
+use Locale::gettext;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Git;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{'vhffs'};
+my $maintemplate = $panel->{'template'};
+my $user = $panel->{'user'};
+#my $group = $panel->{'group'};
+my $projectname = $session->param("project");
+my $cgi = $panel->{'cgi'};
+my $name = $cgi->param("NAME");
+my $template;
+my $templatesdir = $vhffs->get_config->get_templatedir;
+
+
+if( ($user->is_moderator != 1 ) && ( $user->is_admin != 1 ) )
+{
+ $template = new HTML::Template( filename => $templatesdir."/panel/misc/simplemsg.tmpl" );
+ $template->param( MESSAGE => gettext( "You are not allowed to see it") );
+}
+else
+{
+ $template = new HTML::Template( filename => $templatesdir."/panel/admin/misc/list.tmpl" );
+
+ if( defined( $name ) )
+ {
+ $template->param( TITLE => gettext("Search result for git repository") . ": " .$name );
+ }
+ else
+ {
+ $template->param( TITLE => gettext("All git repositories lists") );
+ }
+
+ $template->param(TEXT_TITLE1 => gettext('GIT root'));
+ $template->param(TEXT_TITLE2 => gettext('Group'));
+ $template->param(TEXT_TITLE3 => gettext('State'));
+
+ my $repos = Vhffs::Panel::Git::search( $vhffs, $name );
+
+ if( defined $repos )
+ {
+ my $subtemplate;
+ if( $user->is_admin == 1 ) {
+ $subtemplate = new HTML::Template( filename => $templatesdir."/panel/admin/git/part.tmpl", global_vars => 1 );
+ $subtemplate->param(SEND => gettext('Modify this git repository'));
+ } else {
+ $subtemplate = new HTML::Template( filename => $templatesdir."/panel/admin/git/part-modo.tmpl", global_vars => 1, die_on_bad_params => 0);
+ }
+ $subtemplate->param( GITREPOS => $repos);
+ $template->param( LIST => $subtemplate->output );
+ }
+
+
+}
+
+$panel->build( $template );
+$panel->display;
Property changes on: trunk/vhffs-panel/admin/git/list.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-panel/admin/git/search.pl
===================================================================
--- trunk/vhffs-panel/admin/git/search.pl (rev 0)
+++ trunk/vhffs-panel/admin/git/search.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,85 @@
+#!%PERL% -w
+# 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 POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use strict;
+
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::User;
+use Vhffs::Group;
+use Vhffs::Main;
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Menu;
+use Vhffs::Stats;
+use Vhffs::Constants;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{'vhffs'};
+my $maintemplate = $panel->{'template'};
+my $user = $panel->{'user'};
+#my $group = $panel->{'group'};
+my $projectname = $session->param("project");
+my $cgi = $panel->{'cgi'};
+my $servername = $cgi->param("name");
+my $template;
+
+
+my $templatesdir = $vhffs->get_config->get_templatedir;
+
+if( ($user->is_moderator != 1 ) && ( $user->is_admin != 1 ) )
+{
+
+ $template = new HTML::Template( filename => $templatesdir."/panel/misc/simplemsg.tmpl" );
+ my $message = gettext( "You are not allowed to see it");
+ $template->param( MESSAGE => $message );
+}
+else
+{
+ $template = new HTML::Template( filename => $templatesdir."/panel/admin/git/search.tmpl" );
+
+ $template->param( TITLE => gettext("Search for a GIT repository") );
+
+}
+
+$panel->build( $template );
+$panel->display;
+
Property changes on: trunk/vhffs-panel/admin/git/search.pl
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/vhffs-panel/admin/stats.pl
===================================================================
--- trunk/vhffs-panel/admin/stats.pl 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-panel/admin/stats.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -129,6 +129,11 @@
$template->param( TEXT_TOTAL_SVN_ACTIVATED => gettext("Total activated SVN") );
$template->param( VALUE_TOTAL_SVN_ACTIVATED => $stats->get_svn_activated );
+ $template->param( TEXT_GIT => gettext("GIT stats") );
+ $template->param( TEXT_TOTAL_GIT_IN_MODERATION => gettext("Total GIT in moderation") );
+ $template->param( VALUE_TOTAL_GIT_IN_MODERATION => $stats->get_git_in_moderation );
+ $template->param( TEXT_TOTAL_GIT_ACTIVATED => gettext("Total activated GIT") );
+ $template->param( VALUE_TOTAL_GIT_ACTIVATED => $stats->get_git_activated );
$template->param( TEXT_MAIL => gettext("Mail stats") );
$template->param( TEXT_TOTAL_MAIL_IN_MODERATION => gettext("Total Mail domains in moderation") );
Added: trunk/vhffs-panel/git/create.pl
===================================================================
--- trunk/vhffs-panel/git/create.pl (rev 0)
+++ trunk/vhffs-panel/git/create.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,102 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use strict;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::User;
+use Vhffs::Main;
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Menu;
+use Vhffs::Panel::Group;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{vhffs};
+my $templatedir = $panel->{templatedir};
+my $groupname = $panel->{groupname};
+my $cgi = $panel->{cgi};
+
+my $submitted = $cgi->param('git_submit');
+
+my $reponame;
+my $description;
+
+if($submitted) {
+ my $user = $panel->{user};
+ my $group = $panel->{group};
+ $reponame = $cgi->param('reponame');
+ my $fullreponame = $groupname.'/'.$reponame;
+ $description = $cgi->param('description');
+ if(!(defined $reponame && defined $description)) {
+ $panel->add_error( gettext('CGI error') );
+ } elsif( !Vhffs::Services::Git::check_name($fullreponame) ) {
+ $panel->add_error( gettext('Invalid reponame. It must contain between 3 and 64 characters, only lowercase letters and numbers') );
+ } elsif( $description =~ /^\s*$/) {
+ $panel->add_error( gettext('You must enter a description') );
+ } elsif( defined Vhffs::Panel::Git::create_git( $vhffs, $fullreponame, $description, $user, $group ) ) {
+ my $url = '/group/view.pl?project='.$panel->{groupname}.'&msg='.gettext('The GIT object was successfully created !');
+ $panel->redirect($url);
+ } else {
+ $panel->add_error( gettext('An error occured while creating the git repository') );
+ }
+} else {
+ $reponame = '';
+ $description = '';
+}
+
+if(!$submitted || $panel->has_errors) {
+ my $template = new HTML::Template( filename => $templatedir.'/panel/git/create.tmpl' );
+
+ $panel->set_title( gettext("Create a git Repository") );
+ $template->param( REPOSITORY_NAME => gettext("Repository Name") );
+ $template->param( REPOSITORY_VALUE => CGI::escapeHTML($reponame) );
+ $template->param( GROUP_NAME => gettext("Group owning this git repository") );
+
+ $template->param( GROUP => $groupname );
+ $template->param( SEND => gettext("Send") );
+ $template->param( DESCRIPTION => gettext("Description") );
+ $template->param( DESCRIPTION_VALUE => CGI::escapeHTML($description) );
+ $panel->build( $template );
+$panel->display;
+}
+
Property changes on: trunk/vhffs-panel/git/create.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-panel/git/delete.pl
===================================================================
--- trunk/vhffs-panel/git/delete.pl (rev 0)
+++ trunk/vhffs-panel/git/delete.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,110 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use strict;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::User;
+use Vhffs::Main;
+use Vhffs::Group;
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Menu;
+use Vhffs::Panel::Group;
+use Vhffs::Services::Cvs;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{'vhffs'};
+my $maintemplate = $panel->{'template'};
+my $user = $panel->{'user'};
+my $group = $panel->{'group'};
+my $cgi = $panel->{'cgi'};
+my $message;
+my $owner = $cgi->param("PROJECT_OWNER");
+
+my $repo = $cgi->param( "name" );
+my $sure = $cgi->param( "DELETE" );
+
+my $git = Vhffs::Services::Git::get_by_reponame( $vhffs , $repo );
+
+my $templatedir = $vhffs->get_config->get_templatedir;
+
+if( ( ! defined $repo ) || ( ! defined $sure ) )
+{
+ $message = gettext("CGI Error !");
+}
+elsif( ! defined $git )
+{
+ $message = gettext( "Cannot retrieve informations about this repository" );
+}
+elsif( ( Vhffs::Acl::what_perm_for_user( $user , $git , $vhffs ) < Vhffs::Constants::ACL_DELETE ) && ( $user->is_admin != 1 ) )
+{
+ $message = gettext( "You're not allowed to do this (ACL rights)" );
+}
+elsif( $git->get_status != Vhffs::Constants::ACTIVATED )
+{
+ $message = gettext( "This object is not functionnal yet. Please wait creation or moderation.");
+}
+elsif( $sure == 0 )
+{
+ $message = gettext( "This git repository will NOT be deleted" );
+}
+else
+{
+ $git->set_status( Vhffs::Constants::TO_DELETE );
+
+ # Commit all the changes for the current user
+ if( $git->commit < 0 )
+ {
+ $message = gettext("An error occured while deleting the git repository");
+ }
+ else
+ {
+ $message = gettext("This repository will be deleted");
+ }
+}
+
+my $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+$template->param( MESSAGE => $message );
+
+$panel->build( $template );
+$panel->display;
Property changes on: trunk/vhffs-panel/git/delete.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-panel/git/index.pl
===================================================================
--- trunk/vhffs-panel/git/index.pl (rev 0)
+++ trunk/vhffs-panel/git/index.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,71 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use strict;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Git;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{vhffs};
+my $group = $panel->{group};
+
+if( ! defined($group) ) {
+ $panel->set_title( gettext('Error') );
+ $panel->add_error( gettext('You have to select a group first') );
+ $panel->build;
+ $panel->display;
+} else {
+ # Group is in session => access is granted for user and group is activated
+ # no need to check
+ $panel->set_title( sprintf(gettext('GIT repositories for %s'), $group->get_groupname) );
+ my $git = Vhffs::Panel::Git::getall_per_group( $vhffs, $group->get_gid );
+ if($git < 0) {
+ $panel->add_error( gettext('Unable to get GIT repositories') );
+ $panel->build;
+ $panel->display;
+ } else {
+ $panel->build( $panel->create_service_index('git', $git) );
+ $panel->display;
+ }
+}
+
Property changes on: trunk/vhffs-panel/git/index.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-panel/git/prefs.pl
===================================================================
--- trunk/vhffs-panel/git/prefs.pl (rev 0)
+++ trunk/vhffs-panel/git/prefs.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,164 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use strict;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::User;
+use Vhffs::Group;
+use Vhffs::Main;
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Menu;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{'vhffs'};
+my $maintemplate = $panel->{'template'};
+my $user = $panel->{'user'};
+my $group = $panel->{'group'};
+my $projectname = $session->param("project");
+my $cgi = $panel->{'cgi'};
+my $cgigroupname = $cgi->param('cgigroup');
+my $repo_name = $cgi->param("name");
+my $template;
+my $output;
+my $subtemplate;
+my $git;
+my $templatedir;
+my $message;
+
+$templatedir = $vhffs->get_config->get_templatedir;
+
+if( defined $cgigroupname )
+{
+ $group = Vhffs::Group::get_by_groupname( $vhffs , $cgigroupname );
+}
+
+$git = Vhffs::Services::Git::get_by_reponame( $vhffs , $repo_name );
+
+
+if( ! defined $repo_name )
+{
+ $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+ $message = gettext( "CGI Error" );
+ $template->param( MESSAGE => $message );
+}
+elsif( ! defined $group )
+{
+ $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+ $template->param( MESSAGE => gettext("Grant an user access to this repository") );
+}
+elsif( !defined $git )
+{
+ $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+ $message = gettext( "Cannot get informations on this object");
+ $template->param( MESSAGE => $message );
+
+}
+elsif( ( Vhffs::Acl::what_perm_for_user( $user , $git , $vhffs ) < Vhffs::Constants::ACL_VIEW ) && ( $user->is_admin != 1 ) )
+{
+ $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+ $message = gettext( "You're not allowed to do this (ACL rights)");
+ $template->param( MESSAGE => $message );
+}
+elsif( ( $git->get_status != Vhffs::Constants::ACTIVATED ) && ( $user->is_admin != 1 ) )
+{
+ $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+ $message = gettext( "This object is not functionnal yet. Please wait creation, moderation or modification.");
+ $template->param( MESSAGE => $message );
+}
+else
+{
+ $template = new HTML::Template( filename => $templatedir."/panel/git/prefs.tmpl" );
+
+ $template->param( TEXT_TITLE => gettext("Admin Git Repository") );
+
+
+ $template->param( TEXT_REPONAME => $git->get_reponame );
+ $template->param( TITLE_PUBLIC => gettext("Public") );
+ $template->param( TEXT_PUBLIC => gettext("Is this a public repository ?") );
+ $template->param( PUBLIC_YES => gettext("Yes") );
+ $template->param( PUBLIC_NO => gettext("No") );
+ $template->param( TEXT_SEND => gettext("Modify") );
+ $template->param( TEXT_DELETE_CVS => gettext("Delete this repository") );
+ $template->param( TEXT_BEFORE_DELETE => gettext("This action is non-reversible. All services associated to this project will be DESTROYED.") );
+ $template->param( ASK_DELETE_CVS => gettext("Are you SURE you want DELETE this git repository?") );
+ $template->param( YES => gettext("Yes I'm sure of what I do") );
+ $template->param( NO => gettext("No, I'm not sure, I prefer to keep this project.") );
+ $template->param( TEXT_DELETE => gettext("Delete") );
+
+ $template->param( VALUE_OID => $git->get_oid );
+ $template->param( TEXT_ACL_ADMIN => gettext('Admin Rights on this object (ACL)') );
+ $template->param( EXPLAIN_ADMIN_ACL => gettext('You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it.') );
+ $template->param( ADMIN_ACL => gettext('Ok, go to ACL admin') );
+ $template->param( TITLE_PERM => gettext('Fix permissions in this repository') );
+ $template->param( PERM_TEXT => gettext('Fixing permissions on a repository solve permission access on the repository. Can be helpful if you encounter problems') );
+ $template->param( TEXT_BUTTON_PERM => gettext('Fix them !') );
+
+ $template->param( TITLE_OPT => gettext('Options') );
+ $template->param( TEXT_OPT_ML => gettext('Notify changes on mailing-list :'));
+ $template->param( TEXT_OPT_ML_REMINDER => sprintf( gettext('Don\'t forget to subscribe %s to your mailing list if you are filtering posts') , $vhffs->get_config->get_service('git')->{notify_from} ) );
+ $template->param( TEXT_ML_NAME => $git->{ml_name} );
+
+ if( $git->is_public == 1 )
+ {
+ $template->param( YES_SELECTED => "selected" );
+ }
+ else
+ {
+ $template->param( NO_SELECTED => "selected" );
+ }
+
+ if( $user->is_admin == 1 )
+ {
+ $subtemplate = new HTML::Template( filename => $templatedir."/panel/admin/misc/opart.tmpl" );
+ $subtemplate->param( OID => $git->get_oid );
+ $subtemplate->param( OPART_TEXT => gettext("Go to object-part admin") );
+ $subtemplate->param( OPART_TITLE => gettext("Object part") );
+ $template->param( OPART => $subtemplate->output );
+ }
+
+
+}
+
+$panel->build( $template );
+$panel->display;
Property changes on: trunk/vhffs-panel/git/prefs.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-panel/git/prefs_save.pl
===================================================================
--- trunk/vhffs-panel/git/prefs_save.pl (rev 0)
+++ trunk/vhffs-panel/git/prefs_save.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,143 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use strict;
+use Data::Dumper;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::User;
+use Vhffs::Main;
+use Vhffs::Group;
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Menu;
+use Vhffs::Panel::Group;
+use Vhffs::Services::Git;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{'vhffs'};
+my $maintemplate = $panel->{'template'};
+my $user = $panel->{'user'};
+my $group = $panel->{'group'};
+my $cgi = $panel->{'cgi'};
+my $message;
+my $owner = $cgi->param("PROJECT_OWNER");
+
+my $repo = $cgi->param( "REPO_NAME" );
+my $public = $cgi->param( "PUBLIC" );
+my $ml_name = $cgi->param( "ML_NAME" );
+
+
+my $git = Vhffs::Services::Git::get_by_reponame( $vhffs , $repo );
+
+my $templatedir = $vhffs->get_config->get_templatedir;
+
+if( ! defined $repo )
+{
+ $message = sprintf( gettext("CGI Error ! %s"), $repo );
+}
+elsif( ! defined($git) )
+{
+ $message = gettext( "Cannot retrieve informations about this git repository" );
+}
+elsif( ( Vhffs::Acl::what_perm_for_user( $user , $git , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
+{
+ $message = gettext( "You're not allowed to do this (ACL rights)" );
+}
+elsif( ( $git->get_status != Vhffs::Constants::ACTIVATED ) && ( $user->is_admin != 1 ) )
+{
+ $message = gettext( "This object is not functionnal yet. Please wait creation or moderation.");
+}
+else
+{
+
+ if( defined $public )
+ {
+ if( $public == 1 )
+ {
+ $git->set_public;
+ }
+ else
+ {
+ $git->set_private;
+ }
+
+ $git->set_status( Vhffs::Constants::WAITING_FOR_MODIFICATION );
+ if( $git->commit < 0 )
+ {
+ $message = gettext("An error occured while updating the git repository");
+ }
+ else
+ {
+ $message = gettext("Repository updated");
+ }
+ }
+
+ if ( defined $ml_name ) {
+ if( $ml_name eq '' || Vhffs::Functions::valid_mail($ml_name) > 0) {
+ $git->{ml_name} = $ml_name;
+ if( $git->commit_option < 0 ) {
+ $message = gettext("An error occured while updating the git repository");
+ } else {
+ $message = gettext("Repository updated");
+ $git->set_status( Vhffs::Constants::WAITING_FOR_MODIFICATION );
+ if( $git->commit < 0 )
+ {
+ $message = gettext("An error occured while updating the git repository");
+ }
+ else
+ {
+ $message = gettext("Repository updated");
+ }
+ }
+ } else {
+ $message = gettext('Mailing list address is invalid');
+ }
+ }
+}
+
+my $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
+$template->param( MESSAGE => $message );
+
+$panel->set_refresh_url( "/group/view.pl?project=".$git->get_group->get_groupname, 0);
+$panel->build( $template );
+$panel->display;
Property changes on: trunk/vhffs-panel/git/prefs_save.pl
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-panel/templates/Makefile.am 2007-10-11 15:17:52 UTC (rev 975)
@@ -63,6 +63,9 @@
admin/svn/part-modo.tmpl \
admin/svn/part.tmpl \
admin/svn/search.tmpl \
+ admin/git/part-modo.tmpl \
+ admin/git/part.tmpl \
+ admin/git/search.tmpl \
admin/user/edit-note.tmpl \
admin/user/edit.tmpl \
admin/user/group-part.tmpl \
@@ -133,6 +136,9 @@
svn/create.tmpl \
svn/prefs.tmpl \
svn/user_part.tmpl \
+ git/create.tmpl \
+ git/prefs.tmpl \
+ git/user_part.tmpl \
user/create_complete.tmpl \
user/create.tmpl \
user/mailuserspam.tmpl \
Added: trunk/vhffs-panel/templates/admin/git/part-modo.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/git/part-modo.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/admin/git/part-modo.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,13 @@
+<TMPL_LOOP NAME="GITREPOS">
+<tr>
+ <td>
+ <TMPL_VAR NAME="GITROOT">
+ </td>
+ <td>
+ <TMPL_VAR NAME="GROUPNAME">
+ </td>
+ <td>
+ <TMPL_VAR NAME="STATE">
+ </td>
+</tr>
+</TMPL_LOOP>
Added: trunk/vhffs-panel/templates/admin/git/part.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/git/part.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/admin/git/part.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,21 @@
+<TMPL_LOOP NAME="GITREPOS">
+<tr>
+ <td>
+ <TMPL_VAR NAME="GITROOT">
+ </td>
+ <td>
+ <TMPL_VAR NAME="GROUPNAME">
+ </td>
+ <td>
+ <TMPL_VAR NAME="STATE">
+ </td>
+ <td>
+ <form method="post" action="../../git/prefs.pl">
+ <input type="hidden" id="OID" name="OID" value="<TMPL_VAR NAME="OID">" />
+ <input type="hidden" id="name" name="name" value="<TMPL_VAR NAME="GITROOT">" />
+ <input type="hidden" id="cgigroup" name="cgigroup" value="<TMPL_VAR NAME="GROUPNAME">" />
+ <input type="submit" value="<TMPL_VAR NAME="SEND">" />
+ </form>
+ </td>
+</tr>
+</TMPL_LOOP>
Added: trunk/vhffs-panel/templates/admin/git/search.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/git/search.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/admin/git/search.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,4 @@
+ <h1><TMPL_VAR NAME="TITLE"></h1>
+ <form method="post" action="list.pl">
+ <input type="text" name="NAME" value=""/>
+ </form>
Added: trunk/vhffs-panel/templates/git/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/git/create.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/git/create.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,23 @@
+<form method="post" action="#">
+ <p>
+ <label>
+ <TMPL_VAR NAME="GROUP_NAME">:
+ </label>
+ <TMPL_VAR NAME="GROUP">
+ </p>
+ <p>
+ <label for="reponame">
+ <TMPL_VAR NAME="REPOSITORY_NAME">:
+ </label>
+ <TMPL_VAR NAME="GROUP">/<input type="text" name="reponame" id="reponame" value="<tmpl_var name="REPOSITORY_VALUE">"/>
+ </p>
+ <p>
+ <label for="PROJECT_USAGE">
+ <TMPL_VAR NAME="description">:
+ </label>
+ <textarea name="description" id="description" cols="45" rows="7"><tmpl_var name="DESCRIPTION_VALUE"></textarea>
+ </p>
+ <p class="button" id="buttonSend">
+ <input type="submit" value="<TMPL_VAR NAME="SEND">" name="git_submit"/>
+ </p>
+</form>
Added: trunk/vhffs-panel/templates/git/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/git/prefs.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/git/prefs.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,91 @@
+<h1><tmpl_var name="TEXT_TITLE"> - <tmpl_var name="TEXT_REPONAME"></h1>
+<h2><tmpl_var name="TITLE_PUBLIC"></h2>
+
+
+<form method="post" action="/git/prefs_save.pl">
+ <p>
+ <label for="PUBLIC">
+ <tmpl_var name="TEXT_PUBLIC"> :
+ </label>
+ <select name="PUBLIC" id="PUBLIC">
+ <option value="1" <tmpl_var name="YES_SELECTED">><tmpl_var name="PUBLIC_YES"></option>
+ <option value="0" <tmpl_var name="NO_SELECTED">><tmpl_var name="PUBLIC_NO"></option>
+ </select>
+ </p>
+ <p class="button" id="buttonModify">
+ <input type="hidden" name="REPO_NAME" value="<tmpl_var name="TEXT_REPONAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_SEND">" />
+ </p>
+</form>
+
+<h2><tmpl_var name="TITLE_OPT"></h2>
+<form method="post" action="/git/prefs_save.pl">
+ <p>
+ <label for="OPTION"><tmpl_var name="TEXT_OPT_ML"></label>
+ <input type="text" name="ML_NAME" value="<tmpl_var name="TEXT_ML_NAME">" />
+ <br/>
+ <tmpl_var name="TEXT_OPT_ML_REMINDER">
+ </p>
+ <p class="button" id="buttonModify">
+ <input type="hidden" name="REPO_NAME" value="<tmpl_var name="TEXT_REPONAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_SEND">" />
+ </p>
+</form>
+
+
+<h2><tmpl_var name="TITLE_PERM"></h2>
+<form method="post" action="/git/prefs_save.pl">
+ <p>
+ <label for="PUBLIC">
+ <tmpl_var name="PERM_TEXT">
+ </label>
+ </p>
+ <p class="button" id="buttonModify">
+ <input type="hidden" name="REPO_NAME" value="<tmpl_var name="TEXT_REPONAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_BUTTON_PERM">" />
+ </p>
+</form>
+
+<h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
+
+<form method="post" action="../acl/view.pl">
+ <p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
+
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
+ <p class="button" id="buttonAclAdmin">
+ <input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
+ </p>
+</form>
+
+
+<h2><tmpl_var name="TEXT_DELETE_CVS"></h2>
+
+<form method="post" action="delete.pl">
+ <fieldset class="delete">
+ <legend>
+ <tmpl_var name="ASK_DELETE_CVS">:
+ </legend>
+
+ <p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
+ <label for="DELETE_NO">
+ <tmpl_var name="NO">
+ </label>
+ </p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
+ <label for="DELETE_YES">
+ <tmpl_var name="YES">
+ </label>
+ </p>
+ </fieldset>
+
+ <p class="button" id="buttonDelete">
+ <input type="hidden" name="name" value="<tmpl_var name="TEXT_REPONAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
+ </p>
+
+</form>
+<tmpl_var name="OPART">
+
Added: trunk/vhffs-panel/templates/git/user_part.tmpl
===================================================================
--- trunk/vhffs-panel/templates/git/user_part.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/git/user_part.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,21 @@
+
+<tr>
+ <td><tmpl_var name="VALUE_USERNAME"></td>
+ <td>
+ <form method="post" action="git_chpwd.pl">
+ <input type="text" name="PASSWORD" value="" />
+ <input type="hidden" name="REPO" value="<tmpl_var name="VALUE_REPONAME">" />
+ <input type="hidden" name="USERNAME" value="<tmpl_var name="VALUE_USERNAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_BUTTON_CHANGEPWD">" />
+ </form>
+ </td>
+ <td>
+ <form method="post" action="git_deleteuser.pl">
+ <input type="hidden" name="REPO" value="<tmpl_var name="VALUE_REPONAME">" />
+ <input type="hidden" name="USERNAME" value="<tmpl_var name="VALUE_USERNAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_BUTTON_DELETE">" />
+ </form>
+ </td>
+</tr>
+
+
Added: trunk/vhffs-panel/themes/vhffs/images/git.png
===================================================================
(Binary files differ)
Property changes on: trunk/vhffs-panel/themes/vhffs/images/git.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/vhffs-panel/themes/vhffs/images/gitentry.png
===================================================================
(Binary files differ)
Property changes on: trunk/vhffs-panel/themes/vhffs/images/gitentry.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/vhffs-panel/themes/vhffs/main.css
===================================================================
--- trunk/vhffs-panel/themes/vhffs/main.css 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-panel/themes/vhffs/main.css 2007-10-11 15:17:52 UTC (rev 975)
@@ -721,6 +721,10 @@
list-style-image: url('images/cvsentry.png');
}
+ul.gitList {
+ list-style-image: url('images/gitentry.png');
+}
+
ul.dnsList {
list-style-image: url('images/dnsentry.png');
}
Modified: trunk/vhffs-public/group.pl
===================================================================
--- trunk/vhffs-public/group.pl 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-public/group.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -195,8 +195,35 @@
}
}
+ if( $vhffs->get_config->get_service_availability('git') == 1 )
+ {
+ use Vhffs::Services::Git;
+ $repos = Vhffs::Services::Git::getall_by_group( $vhffs , $group );
+ $output = "";
+ $template->param( GIT_TITLE => gettext("GIT repository for this group"));
+ if( defined $repos )
+ {
+ foreach( @{$repos} )
+ {
+ $subtemplate = new HTML::Template( filename => $templatedir."/public/misc/git-part.tmpl" );
+ $subtemplate->param( GITROOT => $_->get_reponame );
+ $subtemplate->param( DESCRIPTION => CGI::escapeHTML( $_->get_description ) );
+ my $gitpath = $_->get_reponame;
+ $gitpath =~ s/\//_/;
+ $subtemplate->param( GITURL => $vhffs->get_config->get_service('git')->{'gitweb_url'} . '/git_' . $gitpath . '/' );
+ $output .= $subtemplate->output;
+ }
+ $template->param( GIT_VALUE => $output );
+ }
+ else
+ {
+ $template->param( GIT_VALUE => gettext("No git repository available for this group") );
+ }
+ }
+
+
if( $vhffs->get_config->get_service_availability('mailinglist') == 1 )
{
use Vhffs::Services::MailingList;
Modified: trunk/vhffs-public/templates/Makefile.am
===================================================================
--- trunk/vhffs-public/templates/Makefile.am 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-public/templates/Makefile.am 2007-10-11 15:17:52 UTC (rev 975)
@@ -12,6 +12,7 @@
misc/lastusers-part.tmpl \
misc/list-part.tmpl \
misc/svn-part.tmpl \
+ misc/git-part.tmpl \
misc/web-part.tmpl \
simplemsg.tmpl \
user_part.tmpl \
Modified: trunk/vhffs-public/templates/group.tmpl
===================================================================
--- trunk/vhffs-public/templates/group.tmpl 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-public/templates/group.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -34,6 +34,13 @@
</p>
<p>
+ <h2><tmpl_var name="GIT_TITLE"></h2>
+ <ul>
+ <tmpl_var name="GIT_VALUE">
+ </ul>
+ </p>
+
+ <p>
<h2><tmpl_var name="LISTS_TITLE"></h2>
<ul>
<tmpl_var name="LISTS_VALUE">
Added: trunk/vhffs-public/templates/misc/git-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/git-part.tmpl (rev 0)
+++ trunk/vhffs-public/templates/misc/git-part.tmpl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1 @@
+<a href="<tmpl_var name="GITURL">"><tmpl_var name="GITROOT"></a> - <tmpl_var name="TEXT_GROUPNAME"> <a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a> - <tmpl_var name="DESCRIPTION"><br/>
Modified: trunk/vhffs-public/themes/vhffs/main.css
===================================================================
--- trunk/vhffs-public/themes/vhffs/main.css 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-public/themes/vhffs/main.css 2007-10-11 15:17:52 UTC (rev 975)
@@ -707,6 +707,9 @@
ul.svnList {
list-style-image: url('images/svnentry.png');
}
+ul.gitList {
+ list-style-image: url('images/gitentry.png');
+}
ul.cvsList {
list-style-image: url('images/cvsentry.png');
Modified: trunk/vhffs-robots/Makefile.am
===================================================================
--- trunk/vhffs-robots/Makefile.am 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-robots/Makefile.am 2007-10-11 15:17:52 UTC (rev 975)
@@ -53,6 +53,9 @@
src/svn_public.pl \
src/svn_viewvcconf.pl \
src/svn_websvn.pl \
+ src/git_create.pl \
+ src/git_delete.pl \
+ src/git_public.pl \
src/user_create.pl \
src/user_delete.pl \
src/user_group.pl \
Added: trunk/vhffs-robots/src/git_create.pl
===================================================================
--- trunk/vhffs-robots/src/git_create.pl (rev 0)
+++ trunk/vhffs-robots/src/git_create.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,58 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Robots::Git;
+use Vhffs::Services::Git;
+use Vhffs::Constants;
+
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , "git" );
+
+my $repos = Vhffs::Services::Git::getall( $vhffs , Vhffs::Constants::WAITING_FOR_CREATION);
+my $git;
+foreach $git ( @{$repos} )
+{
+ if( Vhffs::Robots::Git::create_repo( $vhffs , $git ) < 0 ) {
+ Vhffs::Robots::vhffs_log( sprintf( "Cannot create GIT %s" , $git->get_reponame ), $vhffs);
+ } else {
+ Vhffs::Robots::vhffs_log( sprintf( "Create GIT %s" , $git->get_reponame ), $vhffs);
+ }
+}
+
+
+Vhffs::Robots::unlock( $vhffs , "git" );
+exit 0;
Property changes on: trunk/vhffs-robots/src/git_create.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-robots/src/git_delete.pl
===================================================================
--- trunk/vhffs-robots/src/git_delete.pl (rev 0)
+++ trunk/vhffs-robots/src/git_delete.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,63 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Robots::Git;
+use Vhffs::Services::Git;
+use Vhffs::Constants;
+
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , "git" );
+
+my $repos = Vhffs::Services::Git::getall( $vhffs , Vhffs::Constants::TO_DELETE);
+my $git;
+foreach $git ( @{$repos} )
+{
+ if( Vhffs::Robots::Git::delete_repo( $vhffs , $git ) < 0 ) {
+ Vhffs::Robots::vhffs_log( sprintf( "Cannot delete files from GIT repository %s" , $git->get_reponame ), $vhffs);
+ } else {
+ Vhffs::Robots::vhffs_log( sprintf( "Delete files from GIT repository %s" , $git->get_reponame ), $vhffs);
+ }
+
+ if( $git->delete < 0 ) {
+ Vhffs::Robots::vhffs_log( sprintf( "Cannot delete GIT repository object %s" , $git->get_reponame ), $vhffs);
+ } else {
+ Vhffs::Robots::vhffs_log( sprintf( "Delete GIT repository object %s" , $git->get_reponame ), $vhffs);
+ }
+}
+
+Vhffs::Robots::unlock( $vhffs , "git" );
+exit 0;
Property changes on: trunk/vhffs-robots/src/git_delete.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/vhffs-robots/src/git_public.pl
===================================================================
--- trunk/vhffs-robots/src/git_public.pl (rev 0)
+++ trunk/vhffs-robots/src/git_public.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,78 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# Copyright © 2007 Julien Danjou <julien@xxxxxxxxxxx>
+# 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 lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Robots::Git;
+use Vhffs::Services::Git;
+use Vhffs::Constants;
+
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , "git" );
+
+my $repos = Vhffs::Services::Git::getall( $vhffs , Vhffs::Constants::WAITING_FOR_MODIFICATION );
+my $git;
+foreach $git ( @{$repos} )
+{
+ $user = $git->get_user;
+ $group = $git->get_group;
+ #First, update uid and gid informations on files
+ if( ( defined $user ) && ( defined $group ) ) {
+ Vhffs::Robots::vhffs_log( sprintf( "GIT change owner/group to %s/%s for repository %s" , $user->get_username , $group->get_groupname , $git->get_dir ) , $vhffs);
+ Vhffs::Functions::change_owner_recur( $git->get_dir , $user->get_uid , $group->get_gid );
+ }
+
+ if( $git->is_public == 1 ) {
+ Vhffs::Robots::vhffs_log( sprintf( "GIT change status %s is now public" , $git->get_dir ) , $vhffs);
+ Vhffs::Functions::chmod_recur( $git->get_dir , 0664 , 02775 );
+ } else {
+ Vhffs::Robots::vhffs_log( sprintf( "GIT change status %s is now private" , $git->get_dir ) , $vhffs);
+ Vhffs::Functions::chmod_recur( $git->get_dir , 0660 , 02770 );
+ }
+
+ Vhffs::Robots::Git::change_conf( $git );
+ $git->set_status( Vhffs::Constants::ACTIVATED );
+
+ if( $git->commit < 0 ) {
+ $git->add_history( "Error while updating repository configuration");
+ } else {
+ $git->add_history( "Successfully modify repository configuration");
+ }
+}
+
+
+Vhffs::Robots::unlock( $vhffs , "git" );
+
+exit 0;
Property changes on: trunk/vhffs-robots/src/git_public.pl
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/vhffs-shells/tuxshell.c
===================================================================
--- trunk/vhffs-shells/tuxshell.c 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-shells/tuxshell.c 2007-10-11 15:17:52 UTC (rev 975)
@@ -6,6 +6,7 @@
* Copyright (C) 1999 Lion Templin <lion@xxxxxxxxxxx>
* Copyright (C) 2002 Igor Genibel <igor@xxxxxxxxxxxxx>
* Copyright (C) 2005 Julien Delange <sod@xxxxxxxxxxxxx>
+ * Copyright (C) 2007 Julien Danjou <julien@xxxxxxxxxxx>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,6 +35,7 @@
#include <syslog.h>
#include <pwd.h>
#include <sys/types.h>
+#include <errno.h>
/* grap is a wrapper designed to verify commands before passing them to system()
or just reporting the accepted command. grap will report an error if the
@@ -83,10 +85,13 @@
/* Define what strings are acceptable in <command>
define an optional execution path CMD_PATH if desired */
-/*char *commands[] = { "cvs" , "svnserve" , NULL };*/
-char *commands[][3] = {
+char *commands[][7] = {
{"cvs" , "server" , NULL },
{"svnserve" , NULL },
+ {"git-upload-pack" , NULL },
+ {"git-fetch-pack" , NULL },
+ {"git-receive-pack" , NULL },
+ {"git-send-pack" , NULL },
{NULL}
};
char **line;
@@ -117,6 +122,8 @@
struct passwd *cuser;
char *username;
+ FILE *plop;
+
openlog("Tuxshell" , LOG_NOWAIT | LOG_NDELAY , LOG_AUTHPRIV );
ok = 0;
@@ -205,8 +212,13 @@
syslog( LOG_INFO , "allow command %s for user %s" , args[CMD_POS] , username );
closelog();
- printf("allowed");
+ /* remove quotes of pathname (needed for git) */
+ if(args[0] && args[1] && args[1][0] == '\'') {
+ args[1]++;
+ args[1][ strlen(args[1])-1 ] = '\0';
+ }
+
/* ok, the command is clear, exec() it */
return (execvp(args[CMD_POS], args));
Modified: trunk/vhffs-tests/conf/vhffs.conf
===================================================================
--- trunk/vhffs-tests/conf/vhffs.conf 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-tests/conf/vhffs.conf 2007-10-11 15:17:52 UTC (rev 975)
@@ -191,6 +191,11 @@
svnweb_url = "http://svnweb.hoster"
</svn>
+ <git>
+ activate = yes
+ gitweb_url = "http://gitweb.hoster"
+ </git>
+
<mail>
activate = yes
use_nospam = yes
Modified: trunk/vhffs-tests/src/Makefile.am
===================================================================
--- trunk/vhffs-tests/src/Makefile.am 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-tests/src/Makefile.am 2007-10-11 15:17:52 UTC (rev 975)
@@ -2,4 +2,4 @@
TESTS = Object.pl Group.pl User.pl Stats.pl Services/Svn.pl \
Services/Cvs.pl Services/Web.pl Services/DNS.pl Services/Mail.pl \
Services/MailingList.pl Services/Mysql.pl Services/Pgsql.pl \
- Functions.pl Services/Repository.pl
+ Functions.pl Services/Repository.pl Services/Git.pl
Added: trunk/vhffs-tests/src/Services/Git.pl
===================================================================
--- trunk/vhffs-tests/src/Services/Git.pl (rev 0)
+++ trunk/vhffs-tests/src/Services/Git.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -0,0 +1,44 @@
+use strict;
+use Vhffs::Tests::Main;
+use Vhffs::Tests::Utils;
+use Vhffs::Constants;
+use Vhffs::User;
+use Vhffs::Services::Git;
+use Test::More 'no_plan';
+
+my $main = init Vhffs::Tests::Main;
+isa_ok($main, 'Vhffs::Tests::Main', '$main');
+
+Vhffs::Tests::Utils::init_db($main->get_db_object);
+
+my $user1 = Vhffs::User::create($main, 'test1', 'abcdef', 0, 'test1@xxxxxxxx');
+isa_ok($user1, 'Vhffs::User', '$user1');
+
+my $group1 = Vhffs::Group::create($main, 'gitgroup1', $user1->get_uid, undef, 'test group for git');
+isa_ok($group1, 'Vhffs::Group', '$group1');
+my $group2 = Vhffs::Group::create($main, 'gitgroup2', $user1->get_uid, undef, 'test group for git');
+isa_ok($group2, 'Vhffs::Group', '$group1');
+
+my $git1 = Vhffs::Services::Git::create($main, 'git1', 'test git repo 1', $user1, $group1);
+isa_ok($git1, 'Vhffs::Services::Git', '$git1');
+cmp_ok($git1->get_reponame, 'eq', 'git1', 'gitroot is the one defined while creating object');
+cmp_ok($git1->get_owner_uid, '==', $user1->get_uid, 'uid matches');
+cmp_ok($git1->get_owner_gid, '==', $group1->get_gid, 'gid matches');
+
+my ($max_oid) = $main->get_db_object->selectrow_array('SELECT MAX(object_id) FROM vhffs_object');
+ok(! defined(Vhffs::Services::Git::create($main, 'git1', 'test git repo 1', $user1, $group1)), 'Unable to create 2 repo with the same name');
+my ($new_max_oid) = $main->get_db_object->selectrow_array('SELECT MAX(object_id) FROM vhffs_object');
+cmp_ok($new_max_oid, '==', $max_oid, 'git service creation is a "all or nothing" process');
+
+my @gits = @{Vhffs::Services::Git::getall($main)};
+cmp_ok(scalar(@gits), '==', 1, 'One Git repository registered');
+is_deeply($gits[0], $git1, 'Activated Git repository is the created one');
+
+cmp_ok(scalar(@{Vhffs::Services::Git::getall($main, Vhffs::Constants::ACTIVATED)}), '==', 0, 'No ACTIVATED git repo');
+
+@gits = @{Vhffs::Services::Git::getall_by_group($main, $group1)};
+cmp_ok(scalar(@gits), '==', 1, 'group1 has one repository');
+is_deeply($gits[0], $git1, 'group1\' repository is the created one');
+
+# FIXME THIS ISN'T COHERENT, FOR get_all WE GOT AN UNDEFINED VALUE AND HERE A ZERO LENGTH ARRAY
+cmp_ok(scalar(@{Vhffs::Services::Git::getall_by_group($main, $group2)}), '==', 0, 'No Git repo for group2');
Modified: trunk/vhffs-tests/src/Stats.pl
===================================================================
--- trunk/vhffs-tests/src/Stats.pl 2007-10-09 21:37:42 UTC (rev 974)
+++ trunk/vhffs-tests/src/Stats.pl 2007-10-11 15:17:52 UTC (rev 975)
@@ -13,6 +13,7 @@
use Vhffs::Services::Mysql;
use Vhffs::Services::Pgsql;
use Vhffs::Services::Svn;
+use Vhffs::Services::Git;
use Vhffs::Services::Mail;
use Vhffs::Services::MailingList;
@@ -241,6 +242,35 @@
is($stats->get_svn_activated, $i, $i > 1 ? "$i SVN services activated" : "$i SVN service activated");
}
+# GIT Stats
+
+for(my $i = 1 ; $i < 10 ; ++$i) {
+ $group = Vhffs::Group::get_by_groupname($main, "testgroup0$i");
+ $user = Vhffs::User::get_by_username($main, "testuser0$i");
+ $svc = Vhffs::Services::Git::create($main, "gittest0$i", "git #$i for stats tests", $user, $group);
+}
+
+$stats->refresh();
+is($stats->get_git_in_moderation, 9, 'All GIT services waiting for moderation');
+for(my $i = 1 ; $i < 10 ; ++$i) {
+ $group = Vhffs::Group::get_by_groupname($main, "testgroup0$i");
+ $svc = Vhffs::Services::Git::get_by_reponame($main, "gittest0$i");
+ $svc->set_status(Vhffs::Constants::WAITING_FOR_CREATION);
+ $svc->commit;
+ $stats->refresh();
+ is($stats->get_git_in_moderation, 9 - $i, (9 - $i).($i >= 8 ? ' GIT service waiting for moderation' : ' GIT services waiting for moderation'));
+ is($stats->get_git_activated, 0, 'No GIT service activated');
+}
+
+for(my $i = 1 ; $i < 10 ; ++$i) {
+ $group = Vhffs::Group::get_by_groupname($main, "testgroup0$i");
+ $svc = Vhffs::Services::Git::get_by_reponame($main, "gittest0$i");
+ $svc->set_status(Vhffs::Constants::ACTIVATED);
+ $svc->commit;
+ $stats->refresh();
+ is($stats->get_git_activated, $i, $i > 1 ? "$i GIT services activated" : "$i GIT service activated");
+}
+
# Mail tests
for(my $i = 1 ; $i < 10 ; ++$i) {