View Issue Details

IDProjectCategoryView StatusLast Update
236WADFMicro HTTP serverpublic28 Jul 2009 22:20
Reportermrosenquist Assigned Totimj  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.12.0 
Target Version0.13.0Fixed in Version0.13.0 
Summary236: Reduce the amount of output from restarting the webserver
DescriptionReduce the amount of out from restarting the webserver
TagsNo tags attached.
Attached Files
Tools_WADF.php.bug263.patch (733 bytes)   
--- /home/mrosenquist/Tools_WADF-0.12.1a/Tools/WADF.php	1970-01-01 10:13:24.000000000 +0100
+++ Tools/WADF.php	2009-07-17 10:51:39.000000000 +0100
@@ -690,12 +690,17 @@
 		}	
 	}
 	
-	public function restartWebserver()
+	public function restartWebserver($verbose=false)
 	{
 		$restart_cmd = $this->resolveMacro('webserver_restart_cmd');
 		if ($restart_cmd != '@webserver_restart_cmd@' && !empty($restart_cmd)) {
 			$this->_debugOutput("Restarting webserver...", self::DEBUG_GENERAL);
-			passthru($restart_cmd);
+			exec($restart_cmd, $out, $ret);
+			if ($ret != 0) {
+				throw new Exception('Error when Restarting webserver: ' . implode("\n", $out));
+			} elseif ($verbose) {
+				print implode("\n", $out);
+			}
 		}
 	}
 	
Tools_WADF.php.bug263.patch (733 bytes)   
wadf.conf.bug236.patch (444 bytes)   
--- wadf.conf.orig	2009-07-17 11:58:37.000000000 +0100
+++ wadf.conf	2009-07-17 11:59:24.000000000 +0100
@@ -280,7 +280,7 @@
 ; becomes default for ALL vhostX_name options
 vhost_name = @hyphen:instance@@vhost_number@.@deploy_domain@
 php_config_location_extra = @home@/.wadf/php.ini
-webserver_restart_cmd = wadf-httpd reloadstart
+webserver_restart_cmd = wadf-httpd -i@instance@ reloadstart
 
 [dev]
 profile_description = Development server
wadf.conf.bug236.patch (444 bytes)   
wadf-httpd.bug263.patch (2,333 bytes)   
--- wadf-httpd.orig	2009-07-17 11:56:46.000000000 +0100
+++ wadf-httpd	2009-07-17 11:58:05.000000000 +0100
@@ -30,6 +30,8 @@
 
 $source_conffile = '@cfg_dir@/Tools_WADF/httpd.conf.sample';
 
+$command = null;
+$appname = null;
 $pidfile = "$WADF_HOME/httpd.pid";
 $portfile = "$WADF_HOME/httpd.port";
 $lockfile = "$WADF_HOME/httpd.lock";
@@ -40,14 +42,17 @@
 $default_error_page = "$WADF_HOME/default_error_page.html";
 $prog = 'WADF HTTPD instance';
 
+$argv_pos = 1;
 if (isset($argv) && isset($argv[1]) && $argv[1] == '-V') {
 	print Tools_WADF::getAboutText();
 	exit(0);
 }
 
-if (!isset($argv) && !isset($argv[1])) {
-	print "Usage: wadf-httpd [start|stop|restart|condrestart|reload|reloadstart|status|graceful|configtest]\n";
+if (!isset($argv) || !isset($argv[$argv_pos])) {
+	print "Usage: [-i site]wadf-httpd [start|stop|restart|condrestart|reload|reloadstart|status|graceful|configtest]\n";
 	exit(5);
+} else {
+	$command = $argv[$argv_pos];
 }
 
 $ret = 0;
@@ -184,7 +189,7 @@
 
 function list_vhosts()
 {
-	global $out, $portfile, $vhost_dir, $default_error_page;
+	global $out, $portfile, $vhost_dir, $default_error_page, $appname;
 	
 	$vhosts = Tools_WADF::getDeployedVhosts($vhost_dir);
 	
@@ -194,7 +199,21 @@
 		exit(5);
 	}
 	
-	if (count($vhosts) > 0) {
+	if (!is_null($appname) && isset($vhosts[$appname])) {
+		$out[] = "Listening on port $port configured for " . count($vhosts) . " applications including $appname:";
+		$details = $vhosts[$appname];
+		
+		$out[] = " $appname: (" . $details['working_dir'] . ')' . "\n   ver=" . $details['deploy_version'];
+		foreach ($details['vhosts'] as $vhost_details) {
+			$vhost_details['interface'] = str_replace('*', ":$port", $vhost_details['interface']);
+			
+			$line = '   http://' . $vhost_details['hostname'] . $vhost_details['interface'];
+			if (isset($vhost_details['description'])) {
+				$line .= ' (' . $vhost_details['description'] . ')';
+			}
+			$out[] = $line;
+		}
+	} elseif (count($vhosts) > 0) {
 		$out[] = "Listening on port $port and configured for the following applications:";
 		foreach ($vhosts as $appname => $details) {
 			$out[] = "\n $appname: (" . $details['working_dir'] . ')' . "\n   ver=" . $details['deploy_version'];
@@ -248,7 +267,7 @@
 
 }
 
-switch ($argv[1]) {
+switch ($command) {
 	case 'start':
 		start();
 		break;
wadf-httpd.bug263.patch (2,333 bytes)   

Activities

timj

19 Jul 2009 00:22

manager   ~244

Fixed in SVN r1814

Issue History

Date Modified Username Field Change
17 Jul 2009 10:34 mrosenquist New Issue
17 Jul 2009 10:48 mrosenquist File Added: Tools_WADF.php.bug263.patch
17 Jul 2009 11:58 mrosenquist File Added: wadf.conf.bug236.patch
17 Jul 2009 11:58 mrosenquist File Added: wadf-httpd.bug263.patch
18 Jul 2009 23:33 timj Assigned To => timj
18 Jul 2009 23:33 timj Status new => assigned
18 Jul 2009 23:33 timj Category CLI => Micro HTTP server
18 Jul 2009 23:33 timj Target Version => 0.12.1
18 Jul 2009 23:33 timj Summary Reduce the amount of out from restarting the webserver from wadf-deploy and wadf-reprocess => Reduce the amount of output from restarting the webserver
18 Jul 2009 23:33 timj Description Updated
19 Jul 2009 00:22 timj Note Added: 244
19 Jul 2009 00:22 timj Status assigned => resolved
19 Jul 2009 00:22 timj Fixed in Version => 0.12.1
19 Jul 2009 00:22 timj Resolution open => fixed
28 Jul 2009 22:20 timj Status resolved => closed