[freeside-commits]
freeside/FS/FS access_user.pm, 1.11, 1.12 Conf.pm,
1.172, 1.173 UID.pm, 1.31, 1.32
Ivan,,,
ivan at wavetail.420.am
Thu Dec 14 01:27:28 PST 2006
- Previous message: [freeside-commits] freeside/bin dbdef-create, 1.10,
1.11 mapsecrets2access_user, 1.4, 1.5
- Next message: [freeside-commits] freeside/FS/bin freeside-addoutsource, 1.4,
1.5 freeside-addoutsourceuser, 1.9, 1.10 freeside-adduser,
1.16, 1.17 freeside-deloutsource, 1.1,
1.2 freeside-deloutsourceuser, 1.1, 1.2 freeside-deluser, 1.1,
1.2 freeside-queued, 1.33, 1.34 freeside-selfservice-server,
1.18, 1.19 freeside-setup, 1.58,
1.59 freeside-sqlradius-radacctd, 1.7, 1.8 freeside-upgrade,
1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv19347/FS/FS
Modified Files:
access_user.pm Conf.pm UID.pm
Log Message:
make the config directory configurable
Index: access_user.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/access_user.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- access_user.pm 28 Nov 2006 09:38:47 -0000 1.11
+++ access_user.pm 14 Dec 2006 09:27:26 -0000 1.12
@@ -2,6 +2,8 @@
use strict;
use vars qw( @ISA $htpasswd_file );
+use FS::UID;
+use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh );
use FS::m2m_Common;
use FS::access_usergroup;
@@ -9,8 +11,11 @@
@ISA = qw( FS::m2m_Common FS::Record );
-#kludge htpasswd for now
-$htpasswd_file = '/usr/local/etc/freeside/htpasswd';
+#kludge htpasswd for now (i hope this bootstraps okay)
+FS::UID->install_callback( sub {
+ my $conf = new FS::Conf;
+ $htpasswd_file = $conf->base_dir. '/htpasswd';
+} );
=head1 NAME
@@ -90,10 +95,13 @@
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my $error =
- $self->SUPER::insert(@_)
- || $self->htpasswd_kludge()
- ;
+ my $error = $self->htpasswd_kludge();
+ if ( $error ) {
+ $dbh->rollback or die $dbh->errstr if $oldAutoCommit;
+ return $error;
+ }
+
+ $error = $self->SUPER::insert(@_);
if ( $error ) {
$dbh->rollback or die $dbh->errstr if $oldAutoCommit;
@@ -126,7 +134,6 @@
}
}
-
=item delete
Delete this record from the database.
@@ -183,10 +190,13 @@
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my $error =
- $new->SUPER::replace($old, @_)
- || $new->htpasswd_kludge()
- ;
+ my $error = $new->htpasswd_kludge();
+ if ( $error ) {
+ $dbh->rollback or die $dbh->errstr if $oldAutoCommit;
+ return $error;
+ }
+
+ $error = $new->SUPER::replace($old, @_);
if ( $error ) {
$dbh->rollback or die $dbh->errstr if $oldAutoCommit;
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- Conf.pm 1 Dec 2006 06:31:55 -0000 1.172
+++ Conf.pm 14 Dec 2006 09:27:26 -0000 1.173
@@ -1,11 +1,15 @@
package FS::Conf;
-use vars qw($default_dir @config_items @card_types $DEBUG );
+use vars qw($default_dir $base_dir @config_items @card_types $DEBUG );
use IO::File;
use File::Basename;
use FS::ConfItem;
use FS::ConfDefaults;
+$base_dir = '%%%FREESIDE_CONF%%%';
+$default_dir = '%%%FREESIDE_CONF%%%';
+
+
$DEBUG = 0;
=head1 NAME
@@ -52,13 +56,15 @@
sub new {
my($proto,$dir) = @_;
my($class) = ref($proto) || $proto;
- my($self) = { 'dir' => $dir || $default_dir } ;
+ my($self) = { 'dir' => $dir || $default_dir,
+ 'base_dir' => $base_dir,
+ };
bless ($self, $class);
}
=item dir
-Returns the directory.
+Returns the conf directory.
=cut
@@ -73,6 +79,23 @@
$1;
}
+=item base_dir
+
+Returns the base directory. By default this is /usr/local/etc/freeside.
+
+=cut
+
+sub base_dir {
+ my($self) = @_;
+ my $base_dir = $self->{base_dir};
+ -e $base_dir or die "FATAL: $base_dir doesn't exist!";
+ -d $base_dir or die "FATAL: $base_dir isn't a directory!";
+ -r $base_dir or die "FATAL: Can't read $base_dir!";
+ -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
+ $base_dir =~ /^(.*)$/;
+ $1;
+}
+
=item config KEY
Returns the configuration value or values (depending on context) for key.
Index: UID.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/UID.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- UID.pm 26 Jul 2006 04:18:01 -0000 1.31
+++ UID.pm 14 Dec 2006 09:27:26 -0000 1.32
@@ -21,7 +21,7 @@
$freeside_uid = scalar(getpwnam('freeside'));
-$conf_dir = "/usr/local/etc/freeside/";
+$conf_dir = "%%%FREESIDE_CONF%%%/";
$AutoCommit = 1; #ours, not DBI
@@ -99,7 +99,7 @@
}
use FS::Schema qw(reload_dbdef);
- reload_dbdef("/usr/local/etc/freeside/dbdef.$datasrc")
+ reload_dbdef("$conf_dir/dbdef.$datasrc")
unless $FS::Schema::setup_hack;
FS::CurrentUser->load_user($user);
- Previous message: [freeside-commits] freeside/bin dbdef-create, 1.10,
1.11 mapsecrets2access_user, 1.4, 1.5
- Next message: [freeside-commits] freeside/FS/bin freeside-addoutsource, 1.4,
1.5 freeside-addoutsourceuser, 1.9, 1.10 freeside-adduser,
1.16, 1.17 freeside-deloutsource, 1.1,
1.2 freeside-deloutsourceuser, 1.1, 1.2 freeside-deluser, 1.1,
1.2 freeside-queued, 1.33, 1.34 freeside-selfservice-server,
1.18, 1.19 freeside-setup, 1.58,
1.59 freeside-sqlradius-radacctd, 1.7, 1.8 freeside-upgrade,
1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list