CVS: ispman/lib/ISPMan ApacheMan.pm,1.38,1.39
Joerg Delker <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs1:/tmp/cvs-serv1744
Modified Files:
ApacheMan.pm
Log Message:
multiple webhost patch
Index: ApacheMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/ApacheMan.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** ApacheMan.pm 6 Jan 2004 21:37:18 -0000 1.38
--- ApacheMan.pm 8 Jan 2004 00:36:11 -0000 1.39
***************
*** 82,107 ****
my $self=shift;
my $r=shift;
! my $dn;
! if ($r->param("dn")) {
! $dn=$r->param("dn");
! } else {
! $dn=$self->getVhostDN($r->param("ispmanDomain") , $r->param("ispmanVhostName"));
! }
$self->{'vhost'}=$self->getVhostInfo($dn);
! my $vhostDN=$self->getVhostDN($r->param("ispmanDomain"), $r->param("ispmanVhostName"));
my $template;
! my $tmpl;
! my $text=$self->getTemplate("vhosts/edit_header.tmpl")->fill_in(PACKAGE => "ISPMan");
if ($self->isDomainEditable($r->param("ispmanDomain"))) {
! $tmpl=($r->param("section"))? join "_", ("edit", $r->param("section")) : "edit";
! $template=$self->getTemplate("vhosts/$tmpl\.tmpl");
} else {
! $template=$self->getTemplate("vhosts/view.tmpl");
}
! $text.=$template->fill_in(PACKAGE => "ISPMan");
! print $text;
}
--- 82,107 ----
my $self=shift;
my $r=shift;
! my $dn;
! if ($r->param("dn")) {
! $dn=$r->param("dn");
! } else {
! $dn=$self->getVhostDN($r->param("ispmanDomain") , $r->param("ispmanVhostName"));
! }
$self->{'vhost'}=$self->getVhostInfo($dn);
! my $vhostDN=$self->getVhostDN($r->param("ispmanDomain"), $r->param("ispmanVhostName"));
my $template;
! my $tmpl;
! my $text=$self->getTemplate("vhosts/edit_header.tmpl")->fill_in(PACKAGE => "ISPMan");
if ($self->isDomainEditable($r->param("ispmanDomain"))) {
! $tmpl=($r->param("section"))? join "_", ("edit", $r->param("section")) : "edit";
! $template=$self->getTemplate("vhosts/$tmpl\.tmpl");
} else {
! $template=$self->getTemplate("vhosts/view.tmpl");
}
! $text.=$template->fill_in(PACKAGE => "ISPMan");
! print $text;
}
***************
*** 225,228 ****
--- 225,231 ----
my $dn=$r->param("dn");
my $template;
+
+ $self->{'domain'}=$self->getDomainInfo($r->param("ispmanDomain"));
+
if ($self->isDomainEditable($r->param("ispmanDomain"))) {
$template=$self->getTemplate("vhosts/add.tmpl");
***************
*** 263,266 ****
--- 266,271 ----
my $documentrootoptions=$self->as_arrayref($r->param("ispmanVhostDocumentRootOption"));
my $scriptdiroptions=$self->as_arrayref($r->param("ispmanVhostScriptDirOption"));;
+ my $webhosts=$self->as_arrayref($r->param("webHost"));
+
if ($r->param("ispmanVhostServerAlias")) {
***************
*** 294,298 ****
$data->{"ispmanVhostScriptDir"} = $r->param("ispmanVhostScriptDir") || join '/', ($r->param("ispmanVhostName"), "cgi-bin");
$data->{"ispmanVhostIpAddress"} = $r->param("ispmanVhostIpAddress") || $self->getConf("apacheVhostsIP") || "*";
! $data->{"webHost"} = $r->param("webHost") || $domain_info->{'ispmanDomainDefaultWebHost'};
$data->{"fileHost"} = $r->param("fileHost") || $domain_info->{'ispmanDomainDefaultFileServer'};
$data->{"DestinationAddress"} = $r->param("fileHost") || $domain_info->{'ispmanDomainDefaultFileServer'};
--- 299,303 ----
$data->{"ispmanVhostScriptDir"} = $r->param("ispmanVhostScriptDir") || join '/', ($r->param("ispmanVhostName"), "cgi-bin");
$data->{"ispmanVhostIpAddress"} = $r->param("ispmanVhostIpAddress") || $self->getConf("apacheVhostsIP") || "*";
! $data->{"webHost"} = $webhosts;
$data->{"fileHost"} = $r->param("fileHost") || $domain_info->{'ispmanDomainDefaultFileServer'};
$data->{"DestinationAddress"} = $r->param("fileHost") || $domain_info->{'ispmanDomainDefaultFileServer'};
***************
*** 321,331 ****
}
! if ($data->{"webHost"}){
! if ($self->addNewEntryWithData($dn, $data)){
! $self->addVhostDNSRecord($r->param("ispmanDomain"), $r->param("ispmanVhostName"), $self->getHostIp($data->{'webHost'}));
! $self->addProcessToHost($r->param("ispmanDomain"), $data->{"webHost"}, "AddVirtualHost", $r->param("ispmanVhostName"));
!
! $self->addVirtualHostDirectoriesProcess(
$r->param("ispmanDomain"),
$r->param("ispmanVhostName"),
--- 326,345 ----
}
+ # write data to LDAP
+ if (! $self->addNewEntryWithData($dn, $data)){ return 0};
+
+ for (@$webhosts){
+ # add new A-record for webhost
+ # NOTICE: for multiple webhosts this will create multiple a-records which
+ # will act as simple round-robin loadbalancing.
+ # Change them manually for proper hardware loadbalancing!
+ $self->addVhostDNSRecord($r->param("ispmanDomain"), $r->param("ispmanVhostName"), $self->getHostIp($_));
! # add process fro vhost creation
! $self->addProcessToHost($r->param("ispmanDomain"), $_, "AddVirtualHost", $r->param("ispmanVhostName"));
! }
!
! # add process for vhost directory creation
! $self->addVirtualHostDirectoriesProcess(
$r->param("ispmanDomain"),
$r->param("ispmanVhostName"),
***************
*** 340,349 ****
$data->{"ispmanVhostLogdir"},
$data->{"ispmanVhostStatdir"}
! )
! );
! return 1;
! }
! }
!
}
--- 354,359 ----
$data->{"ispmanVhostLogdir"},
$data->{"ispmanVhostStatdir"}
! ));
! return 1;
}
***************
*** 498,505 ****
my ($domain, $vhost, $process, $param)=@_;
my $vhostInfo=$self->getVhostInfo($vhost, $domain);
! if ($vhostInfo->{'webHost'}){
! $self->addProcessToHost($domain, $vhostInfo->{'webHost'} , $process, $param);
! } else {
! $self->addProcessToGroup($domain, 'httpgroup' , $process, $param);
}
}
--- 508,515 ----
my ($domain, $vhost, $process, $param)=@_;
my $vhostInfo=$self->getVhostInfo($vhost, $domain);
! my @webHosts=$self->as_array($vhostInfo->{'webHost'});
!
! foreach (@webHosts){
! $self->addProcessToHost($domain, $_, $process, $param);
}
}
***************
*** 512,523 ****
# delete web direcory
! my $self=shift;
! my ($domain, $vhost, $process, $param)=@_;
! my $vhostInfo=$self->getVhostInfo($vhost, $domain);
if ($vhostInfo->{'fileHost'}){
! $self->addProcessToHost($domain, $vhostInfo->{'fileHost'} , $process, $param);
! } elsif ($vhostInfo->{'webHost'}){
! $self->addProcessToHost($domain, $vhostInfo->{'webHost'} , $process, $param);
! } else {
$self->addProcessToGroup($domain, 'fileservergroup' , $process, $param);
}
--- 522,533 ----
# delete web direcory
! my $self=shift;
! my ($domain, $vhost, $process, $param)=@_;
! my $vhostInfo=$self->getVhostInfo($vhost, $domain);
!
!
if ($vhostInfo->{'fileHost'}){
! $self->addProcessToHost($domain, $vhostInfo->{'fileHost'} , $process, $param);
! } else {
$self->addProcessToGroup($domain, 'fileservergroup' , $process, $param);
}
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html