Permalink
Browse files

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

  • Loading branch information...
1 parent b5cc69c commit 802ed73c0a7a03c6dc5c53cd127f6f9f1f2f208b @markstory markstory committed Apr 29, 2009
Showing with 20 additions and 0 deletions.
  1. +20 −0 cake/console/libs/tasks/db_config.php
@@ -349,5 +349,25 @@ function bake($configs) {
$filename = $this->path.'database.php';
return $this->createFile($filename, $out);
}
+
+/**
+ * Get a user specified Connection name
+ *
+ * @return void
+ **/
+ function getConfig() {
+ $useDbConfig = 'default';
+ $configs = get_class_vars('DATABASE_CONFIG');
+
+ if (!is_array($configs)) {
+ return $this->execute();
+ }
+
+ $connections = array_keys($configs);
+ if (count($connections) > 1) {
+ $useDbConfig = $this->in(__('Use Database Config', true) .':', $connections, 'default');
+ }
+ return $useDbConfig;
+ }
}
?>

0 comments on commit 802ed73

Please sign in to comment.