Update of /cvsroot/ispman/ispman/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15610/lib
Modified Files:
create_vhost_directories.lib delete_vhost_directories.lib
http.lib
Log Message:
upgrade to new logdir/statdir style
(remember to run ldifupdate to upgrade your LDAP data)
Index: create_vhost_directories.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/create_vhost_directories.lib,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- create_vhost_directories.lib 24 Jan 2004 17:22:51 -0000 1.10
+++ create_vhost_directories.lib 14 Feb 2004 19:39:06 -0000 1.11
@@ -3,13 +3,17 @@
my ($vhost, $home_directory, $document_root, $script_dir, $owner, $group, $log_dir, $stat_dir)=@_;
my @directories=();
- push @directories, "$home_directory/vhosts/$vhost";
- push @directories, "$home_directory/vhosts/$document_root", unless ($document_root =~ /^\//);
- push @directories, "$home_directory/vhosts/$script_dir", unless ($script_dir =~ /^\//);
- push @directories, "$home_directory/vhosts/$vhost/logs";
- push @directories, "$home_directory/vhosts/$log_dir", if ($log_dir && $log_dir !~ /^\//);
- push @directories, "$home_directory/vhosts/$stat_dir", if ($stat_dir && $stat_dir !~ /^\//);
+ push @directories, "$home_directory";
+ for ($document_root,$script_dir,$log_dir,$stat_dir){
+ if ($_){
+ if ($_ =~ /^\//){
+ push @directories, "$_", unless (-d $_);
+ } else {
+ push @directories, "$home_directory/$_";
+ }
+ }
+ }
my @commands=();
for (@directories){
Index: delete_vhost_directories.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/delete_vhost_directories.lib,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- delete_vhost_directories.lib 1 Feb 2004 15:26:23 -0000 1.3
+++ delete_vhost_directories.lib 14 Feb 2004 19:39:06 -0000 1.4
@@ -3,8 +3,8 @@
# Please provide your own actions for removing any created dir
- # only dirs under vhostdir are deleted by default
- my $command="rm -rf $home_directory/vhosts/$vhost";
+ # only vhost homedir (and therefor everything under it) is deleted by default
+ my $command="rm -rf $home_directory";
print "Running $command\n";
system ($command);
Index: http.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/http.lib,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- http.lib 8 Jan 2004 22:45:02 -0000 1.47
+++ http.lib 14 Feb 2004 19:39:06 -0000 1.48
@@ -119,7 +119,7 @@
vhost => $vhost,
uidNumber => $vhostInfo->{'uidNumber'},
gidNumber => $vhostInfo->{'gidNumber'},
- serverroot => $domainInfo->{'homeDirectory'},
+ homeDirectory => $vhostInfo->{'homeDirectory'},
ispmanVhostServerAlias => $vhostInfo->{'ispmanVhostServerAlias'},
ispmanVhostIpAddress => $vhostInfo->{'ispmanVhostIpAddress'},
ispmanVhostExtraConf => $vhostInfo->{'ispmanVhostExtraConf'},
@@ -131,51 +131,67 @@
urlredirect => $ispman->getRedirections($domain,$vhost),
};
-
+ # build ispmanVhostDocumentRoot
if ($vhostInfo->{'ispmanVhostDocumentRoot'} !~ /^\//) {
- $vhostHash->{$domain}{$vhost}{'documentroot'} = join "/", ($domainInfo->{'homeDirectory'}, "vhosts", $vhostInfo->{'ispmanVhostDocumentRoot'});
+ $vhostHash->{$domain}{$vhost}{'documentroot'} =
+ join "/", ($vhostInfo->{'homeDirectory'},
+ $vhostInfo->{'ispmanVhostDocumentRoot'});
} else {
- ### its a static/non-relative directory. It starts with a "/"
- $vhostHash->{$domain}{$vhost}{'documentroot'} = $vhostInfo->{'ispmanVhostDocumentRoot'};
+ ### its a static/non-relative directory. It starts with a "/"
+ $vhostHash->{$domain}{$vhost}{'documentroot'} =
+ $vhostInfo->{'ispmanVhostDocumentRoot'};
}
-
+
+ # build ispmanVhostScriptDir
if ($vhostInfo->{'ispmanVhostScriptDir'} !~ /^\//) {
- $vhostHash->{$domain}{$vhost}{'scriptdir'} = join "/", ($domainInfo->{'homeDirectory'}, "vhosts", $vhostInfo->{'ispmanVhostScriptDir'});
+ $vhostHash->{$domain}{$vhost}{'scriptdir'} =
+ join "/", ($vhostInfo->{'homeDirectory'},
+ $vhostInfo->{'ispmanVhostScriptDir'});
} else {
- ### its a static/non-relative directory. It starts with a "/"
- $vhostHash->{$domain}{$vhost}{'scriptdir'} = $vhostInfo->{'ispmanVhostScriptDir'};
+ ### its a static/non-relative directory. It starts with a "/"
+ $vhostHash->{$domain}{$vhost}{'scriptdir'} =
+ $vhostInfo->{'ispmanVhostScriptDir'};
}
-
+ # build ispmanVhostLogdir
if ($vhostInfo->{'ispmanVhostLogdir'} =~/\S/) {
- if ($vhostInfo->{'ispmanVhostLogdir'} !~ /^\//) {
- # ispmanVhostLogdir is defined and is not relative
- $vhostHash->{$domain}{$vhost}{'logdir'} = join "/", ($domainInfo->{'homeDirectory'}, "vhosts", $vhostInfo->{'ispmanVhostLogdir'});
- } else {
- ### its a static/non-relative directory. It starts with a "/"
- $vhostHash->{$domain}{$vhost}{'logdir'} = $vhostInfo->{'ispmanVhostLogdir'} ;
- }
+ if ($vhostInfo->{'ispmanVhostLogdir'} !~ /^\//) {
+ # ispmanVhostLogdir is relative
+ $vhostHash->{$domain}{$vhost}{'logdir'} =
+ join "/", ($vhostInfo->{'homeDirectory'},
+ $vhostInfo->{'ispmanVhostLogdir'});
+ } else {
+ # its a static/non-relative directory. It starts with a "/"
+ $vhostHash->{$domain}{$vhost}{'logdir'} =
+ $vhostInfo->{'ispmanVhostLogdir'} ;
+ }
} else {
- ### it is not defined so we use the default apacheLogsDirectory
- $vhostHash->{$domain}{$vhost}{'logdir'} = $apacheLogsDirectory;
+ # ARGH, ispmanVhostLogdir is not defined
+ print "FATAL: ispmanVhostLogdir is not defined for this vhost!\n";
+
+ # don't provide any default because it would cover the error
}
print "Setting logdir to $vhostHash->{$domain}{$vhost}{'logdir'}\n";
+ # build ispmanVhostStatdir
if ($vhostInfo->{'ispmanVhostStatdir'} =~/\S/) {
- if ($vhostInfo->{'ispmanVhostStatdir'} !~ /^\//) {
- $vhostHash->{$domain}{$vhost}{'statdir'} = join "/", ($domainInfo->{'homeDirectory'}, "vhosts", $vhostInfo->{'ispmanVhostStatdir'});
- } else {
- ### its a static/non-relative directory. It starts with a "/"
- $vhostHash->{$domain}{$vhost}{'statdir'} = join "/", ($vhostInfo->{'ispmanVhostStatdir'});
- }
- print "Setting statdir to $vhostHash->{$domain}{$vhost}{'statdir'}\n";
- unless (-d $vhostHash->{$domain}{$vhost}{'statdir'}."/report") {
- print "Statdir ".$vhostHash->{$domain}{$vhost}{'statdir'}."/report did not exist. Creating now.\n";
- print "mkdir -p $vhostHash->{$domain}{$vhost}{'statdir'}/report \n";
- system "mkdir -p $vhostHash->{$domain}{$vhost}{'statdir'}/report \n";
- }
- }
+ if ($vhostInfo->{'ispmanVhostStatdir'} !~ /^\//) {
+ # ispmanStatdir is relative
+ $vhostHash->{$domain}{$vhost}{'statdir'} =
+ join "/", ($vhostInfo->{'homeDirectory'},
+ $vhostInfo->{'ispmanVhostStatdir'});
+ } else {
+ # its a static/non-relative directory. It starts with a "/"
+ $vhostHash->{$domain}{$vhost}{'statdir'} =
+ $vhostInfo->{'ispmanVhostStatdir'};
+ }
+ } else {
+ # ARGH, ispmanVhostStatdir is not defined
+ print "FATAL: ispmanVhostStatdir is not defined for this vhost!\n";
+ # don't provide any default because it would cover the error
+ }
+ print "Setting statdir to $vhostHash->{$domain}{$vhost}{'statdir'}\n";
### Check for log and stat dir and make them if need be
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.