Skip to content
This repository
Browse code

Adding getConfig() so other tasks can pick connections more easily.

  • Loading branch information...
commit 802ed73c0a7a03c6dc5c53cd127f6f9f1f2f208b 1 parent b5cc69c
Mark Story authored April 28, 2009

Showing 1 changed file with 20 additions and 0 deletions. Show diff stats Hide diff stats

  1. 20  cake/console/libs/tasks/db_config.php
20  cake/console/libs/tasks/db_config.php
@@ -349,5 +349,25 @@ function bake($configs) {
349 349
 		$filename = $this->path.'database.php';
350 350
 		return $this->createFile($filename, $out);
351 351
 	}
  352
+
  353
+/**
  354
+ * Get a user specified Connection name
  355
+ *
  356
+ * @return void
  357
+ **/
  358
+	function getConfig() {
  359
+		$useDbConfig = 'default';
  360
+		$configs = get_class_vars('DATABASE_CONFIG');
  361
+
  362
+		if (!is_array($configs)) {
  363
+			return $this->execute();
  364
+		}
  365
+
  366
+		$connections = array_keys($configs);
  367
+		if (count($connections) > 1) {
  368
+			$useDbConfig = $this->in(__('Use Database Config', true) .':', $connections, 'default');
  369
+		}
  370
+		return $useDbConfig;
  371
+	}
352 372
 }
353 373
 ?>

0 notes on commit 802ed73

Please sign in to comment.
Something went wrong with that request. Please try again.