View Issue Details

IDProjectCategoryView StatusLast Update
82WADFCLIpublic17 Oct 2008 12:49
Reportermrosenquist Assigned Totimj  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Target Version0.9.0Fixed in Version0.9.0 
Summary82: wadf-reprocess should show the database(s) that will be removed at the prompt
DescriptionWadf reprocess should show the database(s) that will be removed at the prompt
TagsNo tags attached.
Attached Files
wadf-reprocess.bug82.patch (1,317 bytes)   
--- wadf-reprocess.orig	2008-09-01 09:52:18.000000000 +0100
+++ wadf-reprocess	2008-09-01 10:17:16.000000000 +0100
@@ -85,15 +85,6 @@
 		exit(5);
 }
 
-echo "Do you want to redeploy database(s)? This will ERASE the existing databases (y/n) [default=n]:\n";
-$db_redeploy = strtolower(trim(fgets(STDIN)));
-
-if ($db_redeploy == 'y') {
-	$db_redeploy = true;
-} else {
-	$db_redeploy = false;
-}
-
 $macros = null;
 if ($current_dir) {
 	$macros['deploy_path'] = getcwd();
@@ -105,6 +96,29 @@
 }
 $dir = $WebDeploy->resolveMacro('deploy_path');
 
+$in_use = $WebDeploy->enumerateMultipleEntities();
+$dbs = array(); 
+if (isset($in_use['db'])) {
+	foreach ($in_use['db'] as $num) {
+		$host = $WebDeploy->resolveMacro("db${num}_host");
+		$name = $WebDeploy->resolveMacro("db${num}_name");
+		if ($host == 'localhost') {
+			$dbs[] = "\"$name\"";
+		} else {
+			$dbs[] = "\"$name.$host\"";
+		}
+	}
+}
+echo "Do you want to redeploy ".(count($dbs)>1?'databases':'the database')."? This will ERASE the existing database".(count($dbs)>1?'s':'').' '.implode(', ', $dbs)." (y/n) [default=n]:\n";
+$db_redeploy = strtolower(trim(fgets(STDIN)));
+
+if ($db_redeploy == 'y') {
+	$db_redeploy = true;
+} else {
+	$db_redeploy = false;
+}
+
+
 
 if ($dir == '@deploy_path@') {
 	print "ERROR: resolving deploy_path failed\n";
wadf-reprocess.bug82.patch (1,317 bytes)   
WADF.php.b82.patch (1,090 bytes)   
--- WADF.php.orig	2008-09-01 09:49:54.000000000 +0100
+++ WADF.php	2008-09-01 11:04:38.000000000 +0100
@@ -203,7 +203,7 @@
 		exec($cmd);
 	}
 	
-	protected function _enumerateMultipleEntities()
+	public function enumerateMultipleEntities()
 	{
 		$dir = $this->resolveMacro('deploy_path');
 	
@@ -229,7 +229,7 @@
 	
 	public function deployDatabase()
 	{
-		$in_use = $this->_enumerateMultipleEntities();
+		$in_use = $this->enumerateMultipleEntities();
 		$dir = $this->resolveMacro('deploy_path');
 		
 		// deploy database
@@ -286,7 +286,7 @@
 	
 	public function undeployDatabase()
 	{
-		$in_use = $this->_enumerateMultipleEntities();
+		$in_use = $this->enumerateMultipleEntities();
 		if (isset($in_use['db'])) {
 			foreach ($in_use['db'] as $num) {
 				$host = $this->resolveMacro("db${num}_host");
@@ -357,7 +357,7 @@
 			return;
 		}
 
-		$in_use = $this->_enumerateMultipleEntities();
+		$in_use = $this->enumerateMultipleEntities();
 		if (isset($in_use['vhost'])) {
 			foreach ($in_use['vhost'] as $vhost_id) {
 				$hosts[] = $this->resolveMacro("vhost${vhost_id}_name");
WADF.php.b82.patch (1,090 bytes)   

Activities

mrosenquist

1 Sep 2008 10:26

reporter   ~93

Last edited: 1 Sep 2008 11:06

The patch fixes the bug, however it does not hide the "delete the database" prompt in the cases there are no databases as I am not user if there a futher repercussions.

The Core function enumerateMultipleEntities() has been made public

timj

1 Sep 2008 13:59

manager   ~98

Fixed in SVN r1202

Issue History

Date Modified Username Field Change
1 Sep 2008 10:22 mrosenquist New Issue
1 Sep 2008 10:24 mrosenquist File Added: wadf-reprocess.bug82.patch
1 Sep 2008 10:26 mrosenquist Note Added: 93
1 Sep 2008 11:05 mrosenquist File Added: WADF.php.b82.patch
1 Sep 2008 11:06 mrosenquist Note Edited: 93
1 Sep 2008 13:16 timj Target Version => 0.9.0
1 Sep 2008 13:16 timj Status new => assigned
1 Sep 2008 13:16 timj Assigned To => timj
1 Sep 2008 13:59 timj Status assigned => resolved
1 Sep 2008 13:59 timj Fixed in Version => 0.9.0
1 Sep 2008 13:59 timj Resolution open => fixed
1 Sep 2008 13:59 timj Note Added: 98
1 Sep 2008 14:00 timj Summary Wadf reprocess should show the database(s) that will be removed at the prompt => wadf-reprocess should show the database(s) that will be removed at the prompt
17 Oct 2008 12:49 timj Status resolved => closed