[vhffs-dev] [823] Deleted useless "modules" area of configuration, now using activate flag in each service areas |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [823] Deleted useless "modules" area of configuration, now using activate flag in each service areas
- From: subversion@xxxxxxxxx
- Date: Thu, 30 Aug 2007 05:38:52 +0200
Revision: 823
Author: gradator
Date: 2007-08-30 03:38:51 +0000 (Thu, 30 Aug 2007)
Log Message:
-----------
Deleted useless "modules" area of configuration, now using activate flag in each service areas
Conf::get_service_availability($service) should be used instead of old Conf::use_$service functions which are deprecated and will be removed soon
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Conf.pm
trunk/vhffs-api/src/Vhffs/Functions.pm
trunk/vhffs-backend/conf/vhffs.conf.dist.in
trunk/vhffs-tests/conf/vhffs.conf
Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm 2007-08-30 03:00:48 UTC (rev 822)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm 2007-08-30 03:38:51 UTC (rev 823)
@@ -75,15 +75,8 @@
);
%Config = $conf->getall();
- $Config{users}{default_city} = 'City' unless( defined $Config{'users'}{'default_city'} );
- $Config{users}{default_country} = 'Country' unless( defined $Config{'users'}{'default_country'} );
- $Config{users}{default_lastname} = 'Lastname' unless( defined $Config{'users'}{'default_lastname'} );
- $Config{users}{default_firstname} = 'Firstname' unless( defined $Config{'users'}{'default_firstname'} );
- $Config{users}{default_mail} = 'user\@domain.ex' unless( defined $Config{'users'}{'default_mail'} );
- $Config{users}{default_zipcode} = '121231' unless( defined $Config{'users'}{'default_zipcode'} );
- $Config{users}{default_address} = '1 in the street' unless( defined $Config{'users'}{'default_address'} );
$Config{users}{available_shells} = '/bin/false' unless( defined $Config{'users'}{'available_shells'} );
- $Config{users}{default_shell} = '/bin/false' unless( defined $Config{'users'}{'default_shell'} );
+ $Config{users}{default_shell} = '/bin/false' unless( defined $Config{'users'}{'default_shell'} );
return \%Config;
}
@@ -124,6 +117,16 @@
return $Config{"services"};
}
+
+# get availability of a service (return 1 if open, 0 if closed or unknown)
+sub get_service_availability
+{
+ my $service = shift;
+ use Vhffs::Functions;
+ return Vhffs::Functions::strtoboolean( $Config{'services'}{$service}{'activate'} );
+}
+
+
sub get_default_apache_domain
{
my $self = shift;
@@ -226,100 +229,60 @@
sub use_web
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_web'} );
- return 1 if( $Config{"global"}{"modules"}{'use_web'} eq "yes" );
- return 0;
+ return Vhffs::Conf::get_service_availability('web');
}
-
sub use_cvs
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_cvs'} );
- return 1 if( $Config{"global"}{"modules"}{'use_cvs'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('cvs');
}
-
sub use_svn
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_svn'} );
- return 1 if( $Config{"global"}{"modules"}{'use_svn'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('svn');
}
-
sub use_repository
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_repository'} );
- return 1 if( $Config{"global"}{"modules"}{'use_repository'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('repository');
}
sub use_mail
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_mail'} );
- return 1 if( $Config{"global"}{"modules"}{'use_mail'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('mail');
}
-
-
sub use_mailuser
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_mailuser'} );
- return 1 if( $Config{"global"}{"modules"}{'use_mailuser'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('mailuser');
}
-
sub use_mailgroup
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_mailgroup'} );
- return 1 if( $Config{"global"}{"modules"}{'use_mailgroup'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('mailgroup');
}
-
-
sub use_mailinglist
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_mailinglist'} );
- return 1 if( $Config{"global"}{"modules"}{'use_mailinglist'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('mailinglist');
}
-
sub use_dns
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_dns'} );
- return 1 if( $Config{"global"}{"modules"}{'use_dns'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('dns');
}
-
-
-
-
sub use_pgsql
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_pgsql'} );
- return 1 if( $Config{"global"}{"modules"}{"use_pgsql"} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('pgsql');
}
-
-
-
sub use_mysql
{
- return -1 if( ! defined $Config{"global"}{"modules"}{'use_mysql'} );
- return 1 if( $Config{"global"}{"modules"}{'use_mysql'} eq "yes");
- return 0;
+ return Vhffs::Conf::get_service_availability('mysql');
}
-
-
sub get_allow_subscribe
{
return -1 if( ! defined $Config{"global"}{"allow_subscribe"} );
@@ -341,9 +304,6 @@
}
-
-
-
sub get_datadir
{
return $Config{"global"}{"datadir"};
Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm 2007-08-30 03:00:48 UTC (rev 822)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm 2007-08-30 03:38:51 UTC (rev 823)
@@ -81,6 +81,17 @@
$TYPES_STRINGS[Vhffs::Constants::TYPE_MAIL] = 'Mail Domain';
$TYPES_STRINGS[Vhffs::Constants::TYPE_ML] = 'Mailing List';
+
+# Return 1 if string is either 'yes', 'on', '1', 'y', else return 0
+sub strtoboolean
+{
+ my $str = shift;
+ return 0 unless defined $str;
+ return 1 if( $str eq 'yes' || $str eq 'y' || $str eq 'on' || $str eq '1' );
+ return 0;
+}
+
+
sub hash_mxdomain
{
my $domain = shift;
Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in 2007-08-30 03:00:48 UTC (rev 822)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in 2007-08-30 03:38:51 UTC (rev 823)
@@ -56,25 +56,6 @@
#in order to avoid using of a virtual chroot to provide ftp, sftp, or a shell
use_vhffsfs = no
- ########
- #Modules
- #For each modules, you can use it if you declare "yes"
- #For example, to disable the web service, you
- #can specify use_web = no
- <modules>
- use_web = yes
- use_mysql = yes
- use_mail = no
- use_cvs = no
- use_svn = no
- use_pgsql = no
- use_dns = no
- use_mailinglist = no
- use_mailuser = no
- use_mailgroup = no
- use_repository = no
- </modules>
-
####################
#Panel configuration
<panel>
@@ -180,6 +161,9 @@
<services>
<web>
+ #use this module or not
+ activate = yes
+
# Where to find log from webserver, each webserver should be in a separate directory, example :
# - /data/logs/web/incoming/webserver0
# - /data/logs/web/incoming/webserver1
@@ -219,6 +203,9 @@
</web>
<mysql>
+ #use this module or not
+ activate = yes
+
host = localhost
username = root
password = mysecret
@@ -229,6 +216,9 @@
</mysql>
<pgsql>
+ #use this module or not
+ activate = no
+
host = localhost
username = vhffs
password = mysecret
@@ -240,6 +230,9 @@
#DNS configuration
<dns>
+ #use this module or not
+ activate = no
+
# default configuration for new domains and new entries
default_ns1 = ns1.hoster.org
default_ns2 = ns2.hoster.org
@@ -277,6 +270,9 @@
</dns>
<cvs>
+ #use this module or not
+ activate = no
+
cvsweb_url = "http://cvsweb.hoster"
# URL to the documentation (optional)
@@ -284,6 +280,9 @@
</cvs>
<svn>
+ #use this module or not
+ activate = no
+
svnweb_url = "http://svnweb.hoster"
# URL to the documentation (optional)
@@ -291,6 +290,9 @@
</svn>
<mail>
+ #use this module or not
+ activate = no
+
use_nospam = yes
use_novirus = yes
@@ -303,9 +305,11 @@
#The domain MUST exists on VHFFS, and should be owned by the user given in this configuration
# groupneeded : the user cannot create his mail account if it doesn't have a group
<mailuser>
+ #use this module or not
activate = no
+
+ domain = users.myhost.org
groupneeded = yes
- domain = users.myhost.org
user = cat
# URL to the documentation (optional)
@@ -316,7 +320,9 @@
#With with module, ALL groups get an email address for a domain
#The domain MUST exists on VHFFS, and should be owned by the user given in this configuration
<mailgroup>
+ #use this module or not
activate = no
+
domain = projects.myhost.org
user = cat
@@ -325,12 +331,27 @@
</mailgroup>
<mailinglist>
+ #use this module or not
+ activate = no
+
default_domain = lists.vhffs.org
# URL to the documentation (optional)
url_doc = http://help.myhoster.net/ml
</mailinglist>
+ #Configuration of download repository
+ <repository>
+ #use this module or not
+ activate = no
+
+ repository_url = "http://download.vhffs.org/"
+ default_quota = 1024
+
+ # URL to the documentation (optional)
+ url_doc = http://help.myhoster.net/repository
+ </repository>
+
#Configuration for listengine
<listengine>
#The domain is used when listengine bounces mails to SMTP server
@@ -350,15 +371,6 @@
www-archives = http://localhost/listengine
</listengine>
-
- #Configuration of download repository
- <repository>
- repository_url = "http://download.vhffs.org/"
- default_quota = 1024
-
- # URL to the documentation (optional)
- url_doc = http://help.myhoster.net/repository
- </repository>
</services>
Modified: trunk/vhffs-tests/conf/vhffs.conf
===================================================================
--- trunk/vhffs-tests/conf/vhffs.conf 2007-08-30 03:00:48 UTC (rev 822)
+++ trunk/vhffs-tests/conf/vhffs.conf 2007-08-30 03:38:51 UTC (rev 823)
@@ -42,24 +42,6 @@
moderation = yes
- ########
- #Modules
- #For each modules, you can use it if you declare "yes"
- #For example, to disable the web service, you
- #can specify use_web = no
- <modules>
- use_web = yes
- use_mysql = yes
- use_mail = no
- use_cvs = no
- use_svn = no
- use_pgsql = no
- use_dns = no
- use_mailinglist = no
- use_mailuser = no
- use_repository = no
- </modules>
-
####################
#Panel configuration
<panel>
@@ -156,6 +138,8 @@
#DNS configuration
<dns>
+ activate = yes
+
#Default configuration for each domain-name
default_ns1 = ns1.hoster.org
default_ns2 = ns2.hoster.org
@@ -191,22 +175,31 @@
</dns>
<cvs>
+ activate = yes
cvsweb_url = "http://cvsweb.hoster"
</cvs>
+
<mysql>
+ activate = yes
host = localhost
username = root
password = vhffs
</mysql>
+
<pgsql>
+ activate = yes
host = localhost
username = vhffs
password = zepojf
</pgsql>
+
<svn>
+ activate = yes
svnweb_url = "http://svnweb.hoster"
</svn>
+
<mail>
+ activate = yes
use_nospam = yes
use_novirus = yes
</mail>
@@ -222,7 +215,9 @@
domain = myhost.org
user = cat
</mailuser>
+
<mailing>
+ activate = yes
default_domain = lists.tuxfamily.org
</mailing>
@@ -245,6 +240,8 @@
#Configuration of download repository
<repository>
+ activate = yes
+
repository_url = "http://download.vhffs.org/"
default_quota = 1024
</repository>