[vhffs-dev] [2091] added get_config in Vhffs::Object so that we don' t need to chain $object->get_vhffs->get_config |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [2091] added get_config in Vhffs::Object so that we don' t need to chain $object->get_vhffs->get_config
- From: subversion@xxxxxxxxxxxxx
- Date: Fri, 02 Mar 2012 21:12:44 +0100
Revision: 2091
Author: gradator
Date: 2012-03-02 21:12:43 +0100 (Fri, 02 Mar 2012)
Log Message:
-----------
added get_config in Vhffs::Object so that we don't need to chain $object->get_vhffs->get_config
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Group.pm
trunk/vhffs-api/src/Vhffs/Object.pm
trunk/vhffs-api/src/Vhffs/Panel/User.pm
trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
trunk/vhffs-api/src/Vhffs/Robots/Git.pm
trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm
trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm
trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
trunk/vhffs-api/src/Vhffs/Robots.pm
trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm
trunk/vhffs-api/src/Vhffs/Services/Cron.pm
trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
trunk/vhffs-api/src/Vhffs/Services/DNS.pm
trunk/vhffs-api/src/Vhffs/Services/Git.pm
trunk/vhffs-api/src/Vhffs/Services/Mail.pm
trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm
trunk/vhffs-api/src/Vhffs/Services/Repository.pm
trunk/vhffs-api/src/Vhffs/Services/Svn.pm
trunk/vhffs-api/src/Vhffs/Services/Web.pm
trunk/vhffs-api/src/Vhffs/User.pm
Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Group.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -556,7 +556,7 @@
=cut
sub get_dir {
my $self = shift;
- return $self->get_vhffs->get_config->get_datadir.'/groups/'.substr($self->get_groupname, 0, 1).'/'.substr($self->get_groupname, 1, 1).'/'.$self->get_groupname;
+ return $self->get_config->get_datadir.'/groups/'.substr($self->get_groupname, 0, 1).'/'.substr($self->get_groupname, 1, 1).'/'.$self->get_groupname;
}
=pod
Modified: trunk/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Object.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -308,6 +308,18 @@
=pod
+=head1 get_config
+
+Returns a C<Vhffs::Conf> object.
+
+=cut
+sub get_config {
+ my $self = shift;
+ return $self->get_vhffs->get_config;
+}
+
+=pod
+
=head2 delete
Delete the object. This method is called from inherited class or directly if
Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -251,42 +251,37 @@
$user->{'theme'} = $theme;
}
-sub get_lang
-{
+sub get_lang {
my $user = shift;
- return -1 if( ! defined $user );
+ return -1 unless defined $user;
return $user->get_lang;
}
-sub get_theme
-{
+sub get_theme {
my $user = shift;
- return -1 if( ! defined $user );
+ return -1 unless defined $user;
my $theme = $user->get_theme;
- $theme = $user->get_vhffs->get_config->get_panel->{'default_theme'} unless defined $theme;
+ $theme = $user->get_config->get_panel->{'default_theme'} unless defined $theme;
return $theme;
}
-sub get_shell
-{
+sub get_shell {
my $user = shift;
- return -1 if( ! defined $user );
+ return -1 unless defined $user;
return $user->get_shell;
}
-sub list_shells
-{
+sub list_shells {
my $vhffs = shift;
return -1 unless defined $vhffs;
return split(/ /,$vhffs->get_config->get_users->{'available_shells'});
}
-sub default_shell
-{
+sub default_shell {
my $vhffs = shift;
return -1 unless defined $vhffs;
return $vhffs->get_config->get_users->{'default_shell'};
Modified: trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -131,7 +131,7 @@
my $vhffs = $bazaar->get_vhffs;
my $dir = $bazaar->get_dir;
- my $mail_from = $bazaar->get_vhffs->get_config->get_service('bazaar')->{notify_from};
+ my $mail_from = $bazaar->get_config->get_service('bazaar')->{notify_from};
if( $bazaar->get_ml_name !~ /^\s*$/ ) {
# TODO: Bazaar mail on commit
Modified: trunk/vhffs-api/src/Vhffs/Robots/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Git.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Robots/Git.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -151,7 +151,7 @@
$git->add_history( 'Is now private');
}
- my $mail_from = $git->get_vhffs->get_config->get_service('git')->{'notify_from'};
+ my $mail_from = $git->get_config->get_service('git')->{'notify_from'};
# Always unlink since git init create a dummy post-receive
unlink $dir.'/hooks/post-receive';
Modified: trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -145,7 +145,7 @@
$mercurial->add_history( 'Is now private');
}
- my $mail_from = $mercurial->get_vhffs->get_config->get_service('mercurial')->{notify_from};
+ my $mail_from = $mercurial->get_config->get_service('mercurial')->{notify_from};
my $mladdress = $mercurial->{ml_name};
my $rcfileoutpath = $dir.'/.hg/hgrc';
Modified: trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -174,7 +174,7 @@
sub _dump {
my $mysql = shift;
- my $mysqlconf = $mysql->get_vhffs->get_config->get_service('mysql');
+ my $mysqlconf = $mysql->get_config->get_service('mysql');
return undef unless defined $mysqlconf;
my ( $tmpfile, $tmppath ) = Vhffs::Robots::tmpfile( $mysql->get_vhffs );
Modified: trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -175,7 +175,7 @@
sub _dump {
my $pg = shift;
- my $pgsqlconf = $pg->get_vhffs->get_config->get_service('pgsql');
+ my $pgsqlconf = $pg->get_config->get_service('pgsql');
return undef unless defined $pgsqlconf;
# create the postgres password file
Modified: trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Svn.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Robots/Svn.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -188,7 +188,7 @@
}
# Commit mail
- my $svnconf = $svn->get_vhffs->get_config->get_service('svn');
+ my $svnconf = $svn->get_config->get_service('svn');
my $mailfrom = $svnconf->{'notify_from'};
my $mailto = $svn->{ml_name};
if( defined $mailfrom and defined $mailto ) {
Modified: trunk/vhffs-api/src/Vhffs/Robots.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Robots.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -217,7 +217,7 @@
return undef unless defined $object and defined $dir and -d $dir;
- my $robotconf = $object->get_vhffs->get_config->get_robots;
+ my $robotconf = $object->get_config->get_robots;
return undef unless defined $robotconf and $robotconf->{'archive_deleted'} and defined $robotconf->{'archive_deleted_path'} and -d $robotconf->{'archive_deleted_path'};
my $oldcwd = getcwd();
Modified: trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -217,7 +217,7 @@
=cut
sub get_base_dir {
my $self = shift;
- return $self->get_vhffs->get_config->get_datadir.'/bazaar/bazaarroot';
+ return $self->get_config->get_datadir.'/bazaar/bazaarroot';
}
1;
Modified: trunk/vhffs-api/src/Vhffs/Services/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Cron.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Cron.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -232,7 +232,7 @@
sub set_interval {
my ($self, $value) = @_;
- my $mininterval = $self->get_vhffs->get_config->get_service('cron')->{'minimum_interval'}*60;
+ my $mininterval = $self->get_config->get_service('cron')->{'minimum_interval'}*60;
$value = $mininterval if( $value < $mininterval );
$self->{'interval'} = $value;
return 0;
Modified: trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Cvs.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Cvs.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -245,7 +245,7 @@
=cut
sub get_base_dir {
my $self = shift;
- return $self->get_vhffs->get_config->get_datadir.'/cvs/cvsroot';
+ return $self->get_config->get_datadir.'/cvs/cvsroot';
}
1;
Modified: trunk/vhffs-api/src/Vhffs/Services/DNS.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/DNS.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/DNS.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -437,7 +437,7 @@
return -2 if ( $self->name_exists( $name, 'A', 'CNAME' ) != 0 );
unless( defined $ip ) {
- my $dnsconfig = $self->get_vhffs->get_config->get_service('dns');
+ my $dnsconfig = $self->get_config->get_service('dns');
if( defined $dnsconfig->{'default_a'} ) {
$ip = $dnsconfig->{'default_a'};
} else {
@@ -649,7 +649,7 @@
return -2 if ( $self->name_exists( $name, 'CNAME', 'AAAA' ) != 0 );
unless( defined $ip ) {
- my $dnsconfig = $self->get_vhffs->get_config->get_service('dns');
+ my $dnsconfig = $self->get_config->get_service('dns');
if( defined $dnsconfig->{'default_aaaa'} ) {
$ip = $dnsconfig->{'default_aaaa'};
} else {
@@ -839,7 +839,7 @@
my $self = shift;
return -1 unless ( defined $self && defined $self->{'dns_id'} );
- my $conf = $self->get_vhffs->get_config->get_service('dns');
+ my $conf = $self->get_config->get_service('dns');
return -1 unless defined $conf;
#Update the serial to refresh the domain
Modified: trunk/vhffs-api/src/Vhffs/Services/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Git.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Git.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -219,7 +219,7 @@
=cut
sub get_base_dir {
my $self = shift;
- return $self->get_vhffs->get_config->get_datadir.'/git/gitroot';
+ return $self->get_config->get_datadir.'/git/gitroot';
}
1;
Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -274,7 +274,7 @@
my $self = shift;
return undef unless defined $self;
- return( $self->get_vhffs->get_config->get_datadir . '/mail/boxes/' . $self->{'boxes_path'} );
+ return( $self->get_config->get_datadir . '/mail/boxes/' . $self->{'boxes_path'} );
}
sub change_forward {
@@ -472,7 +472,7 @@
my $local_part = shift;
return undef unless defined $self and defined $local_part and defined $self->{'boxes'}{$local_part};
- return( $self->get_vhffs->get_config->get_datadir . '/mail/boxes/' . $self->{'boxes_path'} . '/' . $self->{'boxes'}{$local_part}{'mbox_name'} );
+ return( $self->get_config->get_datadir . '/mail/boxes/' . $self->{'boxes_path'} . '/' . $self->{'boxes'}{$local_part}{'mbox_name'} );
}
=pod
Modified: trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Mercurial.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -218,7 +218,7 @@
=cut
sub get_base_dir {
my $self = shift;
- return $self->get_vhffs->get_config->get_datadir.'/mercurial/mercurialroot';
+ return $self->get_config->get_datadir.'/mercurial/mercurialroot';
}
1;
Modified: trunk/vhffs-api/src/Vhffs/Services/Repository.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Repository.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Repository.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -232,7 +232,7 @@
sub get_dir {
my $self = shift;
- return $self->get_vhffs->get_config->get_datadir.'/repository/'.$self->get_name;
+ return $self->get_config->get_datadir.'/repository/'.$self->get_name;
}
1;
Modified: trunk/vhffs-api/src/Vhffs/Services/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Svn.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Svn.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -228,7 +228,7 @@
=cut
sub get_base_dir {
my $self = shift;
- return $self->get_vhffs->get_config->get_datadir.'/svn/svnroot';
+ return $self->get_config->get_datadir.'/svn/svnroot';
}
1;
Modified: trunk/vhffs-api/src/Vhffs/Services/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Web.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/Services/Web.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -211,7 +211,7 @@
my $self = shift;
require Digest::MD5;
my $hash = Digest::MD5::md5_hex( $self->{'servername'} );
- return $self->get_vhffs->get_config->get_datadir.'/web/'.$self->get_hash();
+ return $self->get_config->get_datadir.'/web/'.$self->get_hash();
}
=head2 get_hash
Modified: trunk/vhffs-api/src/Vhffs/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm 2012-03-02 19:58:58 UTC (rev 2090)
+++ trunk/vhffs-api/src/Vhffs/User.pm 2012-03-02 20:12:43 UTC (rev 2091)
@@ -352,7 +352,7 @@
sub commit {
my $self = shift;
- $self->{'shell'} = $self->get_vhffs->get_config->get_users->{'default_shell'} unless defined $self->{'shell'};
+ $self->{'shell'} = $self->get_config->get_users->{'default_shell'} unless defined $self->{'shell'};
$self->{'admin'} = 0 unless defined $self->{'admin'};
return -1 unless defined $self->{'passwd'} and $self->{'passwd'} ne '';