ispman/tasks AddVirtualHost_task.pl, 1.1, 1.1.2.1 DeleteVirtualHost_task.pl, 1.4, 1.4.2.1 ModifyVirtualHost_task.pl, 1.1, 1.1.2.1

Pedro Algarvio <[email protected]> Mon, 02 Oct 2006 08:09:41 +0000
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/tasks
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27827/tasks

Modified Files:
      Tag: dev_1_3-cyrus_virtdomain
	AddVirtualHost_task.pl DeleteVirtualHost_task.pl 
	ModifyVirtualHost_task.pl 
Log Message:
Merged to current HEAD, still needs debuging though.


Index: AddVirtualHost_task.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/tasks/AddVirtualHost_task.pl,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -d -r1.1 -r1.1.2.1
--- AddVirtualHost_task.pl	30 Dec 2004 04:15:43 -0000	1.1
+++ AddVirtualHost_task.pl	2 Oct 2006 08:09:38 -0000	1.1.2.1
@@ -1,17 +1,23 @@
 sub AddVirtualHost_task {
-   my $params=shift;
-   unless ($params->{'domain'}){
-      print "Domain not defined. Cannot continue\n";
-      return 0;
-   }
-   unless ($params->{'ispmanVhostName'}){
-      print "Vhostname not defined. Cannot continue\n";
-      return 0;
-   }
-   push @cmd, "perl $FindBin::Bin/ispman.add_vhost $params->{'ispmanVhostName'} $params->{'domain'}";
-   push @cmd, "perl $FindBin::Bin/ispman.make_vhosts_conf $params->{'domain'}";
-   push @cmd, "perl $FindBin::Bin/ispman.reloadApache";
+    my $params = shift;
+    unless ( $params->{'domain'} ) {
+        print STDERR "Domain not defined. Cannot continue\n";
+        return 0;
+    }
+    unless ( $params->{'ispmanVhostName'} ) {
+        print STDERR "Vhostname not defined. Cannot continue\n";
+        return 0;
+    }
 
+    # require our http interface library
+    require "http.lib";
 
+    # add vhost to configuration
+    add_vhost( $params->{'ispmanVhostName'}, $params->{'domain'} );
 
+    # generate webserver configuration
+    make_vhosts_conf( $params->{'domain'} );
+
+    # reload webserver
+    return reloadServer();
 }

Index: ModifyVirtualHost_task.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/tasks/ModifyVirtualHost_task.pl,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -d -r1.1 -r1.1.2.1
--- ModifyVirtualHost_task.pl	30 Dec 2004 04:32:27 -0000	1.1
+++ ModifyVirtualHost_task.pl	2 Oct 2006 08:09:38 -0000	1.1.2.1
@@ -1,17 +1,23 @@
 sub ModifyVirtualHost_task {
-   my $params=shift;
-   unless ($params->{'domain'}){
-      print "Domain not defined. Cannot continue\n";
-      return 0;
-   }
-   unless ($params->{'ispmanVhostName'}){
-      print "Vhostname not defined. Cannot continue\n";
-      return 0;
-   }
-   push @cmd, "perl $FindBin::Bin/ispman.modify_vhost $params->{'ispmanVhostName'} $params->{'domain'}";
-   push @cmd, "perl $FindBin::Bin/ispman.make_vhosts_conf $params->{'domain'}";
-   push @cmd, "perl $FindBin::Bin/ispman.reloadApache";
+    my $params = shift;
+    unless ( $params->{'domain'} ) {
+        print STDERR "Domain not defined. Cannot continue\n";
+        return 0;
+    }
+    unless ( $params->{'ispmanVhostName'} ) {
+        print STDERR "Vhostname not defined. Cannot continue\n";
+        return 0;
+    }
 
+    require "http.lib";
 
+    # modify vhost config
+    modify_vhost( $params->{'ispmanVhostName'}, $params->{'domain'} );
+
+    # generate configuration
+    make_vhosts_conf( $params->{'domain'} );
+
+    # reload webserver
+    return reloadServer();
 
 }

Index: DeleteVirtualHost_task.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/tasks/DeleteVirtualHost_task.pl,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -d -r1.4 -r1.4.2.1
--- DeleteVirtualHost_task.pl	30 Dec 2004 04:32:25 -0000	1.4
+++ DeleteVirtualHost_task.pl	2 Oct 2006 08:09:38 -0000	1.4.2.1
@@ -1,20 +1,23 @@
 #!/usr/bin/perl
 sub DeleteVirtualHost_task {
-   my $params=shift;
-   
-   unless ($params->{'domain'}){
-      print "Domain not defined. Cannot continue\n";
-      return 0;
-   }
-   unless ($params->{'ispmanVhostName'}){
-      print "Vhostname not defined. Cannot continue\n";
-      return 0;
-   }
+    my $params = shift;
 
+    unless ( $params->{'domain'} ) {
+        print STDERR "Domain not defined. Cannot continue\n";
+        return 0;
+    }
+    unless ( $params->{'ispmanVhostName'} ) {
+        print STDERR "Vhostname not defined. Cannot continue\n";
+        return 0;
+    }
 
-   push @cmd, "perl $FindBin::Bin/ispman.delete_vhost $params->{'ispmanVhostName'} $params->{'domain'} ";
-   push @cmd, "perl $FindBin::Bin/ispman.make_vhosts_conf $params->{'domain'} ";
-   push @cmd, "perl $FindBin::Bin/ispman.reloadApache";
+    # delete vhost config
+    delete_vhost( $params->{'ispmanVhostName'}, $params->{'domain'} );
 
+    # generate webserver configuration
+    make_vhosts_conf( $params->{'domain'} );
+
+    # reload webserver
+    return reloadServer();
 
 }


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV