view release on metacpan or search on metacpan
bin/voodoo-control view on Meta::CPAN
print " Apache Prefix Path: ", $cnf->prefix(),"\n";
print " App Install Path: ", $cnf->install_path(),"\n";
print " Session Path: ", $cnf->session_path(),"\n";
print " Config File Path: ", $cnf->conf_path(),"\n";
print " Config File Name: ", $cnf->conf_file(),"\n";
print " Update File Path: ", $cnf->updates_path(),"\n";
print " Template File Path: ", $cnf->tmpl_path(),"\n";
print " Perl Module Path: ", $cnf->code_path(),"\n";
print " Apache UID: ", $cnf->apache_uid(),"\n";
print " Apache GID: ", $cnf->apache_gid(),"\n";
print "Debug DB Connection: ", $cnf->debug_dbd()->[0],"\n";
print " Debug DB Username: ", $cnf->debug_dbd()->[1],"\n";
print " Debug DB Password: ", $cnf->debug_dbd()->[2],"\n";
print " Debug URL Path: ", $cnf->debug_path(),"\n";
print "\n";
print "Config settings stored in: ", $INC{'Apache/Voodoo/MyConfig.pm'},"\n";
exit 0;
}
sub setconfig {
lib/Apache/Voodoo/Constants.pm view on Meta::CPAN
die "There was an error loading $p. Please run \"voodoo-control setconfig\"\n";
}
# copy the config.
my %h = eval '%{$'.$p."::CONFIG}";
foreach (keys %h) {
$self->{$_} = $h{$_};
}
}
sub apache_gid { return $_[0]->{APACHE_GID}; }
sub apache_uid { return $_[0]->{APACHE_UID}; }
sub code_path { return $_[0]->{CODE_PATH}; }
sub conf_file { return $_[0]->{CONF_FILE}; }
sub conf_path { return $_[0]->{CONF_PATH}; }
sub install_path { return $_[0]->{INSTALL_PATH}; }
sub prefix { return $_[0]->{PREFIX}; }
sub session_path { return $_[0]->{SESSION_PATH}; }
sub tmpl_path { return $_[0]->{TMPL_PATH}; }
sub updates_path { return $_[0]->{UPDATES_PATH}; }
sub debug_dbd { return $_[0]->{DEBUG_DBD}; }
lib/Apache/Voodoo/Debug/Native/SQLite.pm view on Meta::CPAN
sub init_db {
my $self = shift;
my $dbh = shift;
my $ac = shift;
# find the name of the connected database file
my @f = grep {$_->[1] eq "main" } @{$dbh->selectall_arrayref("pragma database_list") || $self->db_error()};
# make sure it's owned by apache
chown($ac->apache_uid,$ac->apache_gid,$f[0]->[2]);
$self->{dbh} = $dbh;
my $tables = $dbh->selectcol_arrayref("
SELECT
name
FROM
sqlite_master
WHERE
type='table' AND
lib/Apache/Voodoo/Install.pm view on Meta::CPAN
$self->debug(": missing, created");
}
}
sub make_writeable_dirs {
my $self = shift;
my @dirs = shift;
my $pretend = $self->{'pretend'};
my $uid = $self->{'apache_uid'};
my $gid = $self->{'apache_gid'};
foreach my $dir (@dirs) {
$self->info("- Checking directory $dir");
stat($dir);
if (-e _ && -d _ ) {
$self->debug(": ok");
}
else {
$pretend || mkdir($dir,770) || $self->{ignore} || die "Can't create directory $dir: $!";
$self->debug(": created");
}
$self->info("- Making sure the $dir directory is writable by apache");
$pretend || chown($uid,$gid,$dir) || $self->{ignore} || die "Can't chown directory: $!";
$pretend || chmod(0770,$dir) || $self->{ignore} || die "Can't chmod directory: $!";
$self->debug(": ok");
}
}
sub make_writeable_files {
my $self = shift;
my @files = shift;
my $pretend = $self->{'pretend'};
my $uid = $self->{'apache_uid'};
my $gid = $self->{'apache_gid'};
foreach my $file (@files) {
$self->info("- Checking file $file");
if (-e $file) {
$self->debug(": ok");
}
else {
$pretend || (system("touch $file") && ($self->{ignore} || die "Can't create file: $!"));
$self->debug(": created");
}
$self->info("- Making sure the $file directory is writable by apache");
$pretend || chown($uid,$gid,$file) || $self->{ignore} || die "Can't chown file: $!";
$pretend || chmod(0600,$file) || $self->{ignore} || die "Can't chmod file: $!";
$self->debug(": ok");
}
}
# In a pine box somewhere De Morgan is either spinning violently, or applauding. We're not
# sure which.
1;
lib/Apache/Voodoo/Install/Config.pm view on Meta::CPAN
# get settings
$self->prefix();
$self->install_path();
$self->session_path();
$self->conf_path();
$self->updates_path();
$self->conf_file();
$self->tmpl_path();
$self->code_path();
$self->apache_uid();
$self->apache_gid();
$self->debug_dbd();
$self->debug_path();
return if $self->{"pretend"};
# save settings
my %cfg = %{$self};
my $path = $INC{"Apache/Voodoo/MyConfig.pm"} || $INC{"Apache/Voodoo/Install/Config.pm"};
$path =~ s/Install\/Config.pm$/MyConfig\.pm/;
lib/Apache/Voodoo/Install/Config.pm view on Meta::CPAN
my $apache = prompt("User that Apache runs as",$default);
my (undef,undef,$uid,undef) = getpwnam($apache);
if ($uid =~ /^\d+$/) {
$self->{'APACHE_UID'} = $uid;
last;
}
print "Can't find this user. Please try again.\n";
}
}
sub apache_gid {
my $self = shift;
my $default = "apache";
if ($self->{'APACHE_GID'}) {
my $d = (getgrgid($self->{APACHE_GID}))[0];
$default = $d if ($d);
}
while (1) {
my $apache = prompt("Group that Apache runs as",$default);
my (undef,undef,undef,$gid) = getpwnam($apache);
if ($gid =~ /^\d+$/) {
$self->{'APACHE_GID'} = $gid;
last;
}
print "Can't find this group. Please try again.\n";
}
}
sub debug_dbd {
my $self = shift;
unless ($self->{DEBUG_DBD}) {
lib/Apache/Voodoo/Install/Distribution.pm view on Meta::CPAN
my $ac = Apache::Voodoo::Constants->new();
$self->{'ac'} = $ac;
$self->{'install_path'} = File::Spec->catfile($ac->install_path(),$self->{'app_name'});
$self->{'conf_file'} = File::Spec->catfile($self->{'install_path'},$ac->conf_file());
$self->{'conf_path'} = File::Spec->catfile($self->{'install_path'},$ac->conf_path());
$self->{'updates_path'} = File::Spec->catfile($self->{'install_path'},$ac->updates_path());
$self->{'apache_uid'} = $ac->apache_uid();
$self->{'apache_gid'} = $ac->apache_gid();
bless $self,$class;
return $self;
}
sub app_name {
my $self = shift;
$self->{'app_name'} = $_[0] if $_[0];
return $self->{'app_name'};
lib/Apache/Voodoo/Install/Post.pm view on Meta::CPAN
my $self = {%params};
my $ac = Apache::Voodoo::Constants->new();
$self->{'_md5_'} = Digest::MD5->new;
$self->{'prefix'} = $ac->prefix();
$self->{'install_path'} = $ac->install_path()."/".$self->{'app_name'};
$self->{'conf_file'} = $self->{'install_path'}."/".$ac->conf_file();
$self->{'apache_uid'} = $ac->apache_uid();
$self->{'apache_gid'} = $ac->apache_gid();
unless (-e $self->{'conf_file'}) {
die "Can't open configuration file: $self->{'conf_file'}\n";
}
$self->{'conf_data'} = { ParseConfig($self->{'conf_file'}) };
bless $self, $class;
return $self;
}
lib/Apache/Voodoo/Install/Updater.pm view on Meta::CPAN
my $ac = Apache::Voodoo::Constants->new();
$self->{'_md5_'} = Digest::MD5->new;
$self->{'install_path'} = $ac->install_path()."/".$self->{'app_name'};
$self->{'conf_file'} = $self->{'install_path'}."/".$ac->conf_file();
$self->{'conf_path'} = $self->{'install_path'}."/".$ac->conf_path();
$self->{'updates_path'} = $self->{'install_path'}."/".$ac->updates_path();
$self->{'apache_uid'} = $ac->apache_uid();
$self->{'apache_gid'} = $ac->apache_gid();
unless (-e $self->{'conf_file'}) {
die "Can't open configuration file: $self->{'conf_file'}\n";
}
bless $self, $class;
return $self;
}
t/Constants.t view on Meta::CPAN
ok($@ =~ /Can't find nosuch::config/, "no such config file");
eval { Apache::Voodoo::Constants->new('test_data::BrokenConfig') };
ok($@ =~ /There was an error loading/, "broken config");
my $c = Apache::Voodoo::Constants->new('test_data::MyConfig');
my $c2 = Apache::Voodoo::Constants->new('test_data::MyConfig');
is("$c","$c2","is a singleton");
foreach (
['apache_gid', 80],
['apache_uid', 81],
['code_path', 'code'],
['conf_file', 'etc/voodoo.conf'],
['conf_path', 'etc'],
['install_path', '/data/apache/sites'],
['prefix', '/data/apache'],
['session_path', '/data/apache/session'],
['tmpl_path', 'html'],
['updates_path', 'etc/updates'],
['debug_dbd', [