From 802ed73c0a7a03c6dc5c53cd127f6f9f1f2f208b Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 28 Apr 2009 20:44:23 -0400 Subject: [PATCH] Adding getConfig() so other tasks can pick connections more easily. --- cake/console/libs/tasks/db_config.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cake/console/libs/tasks/db_config.php b/cake/console/libs/tasks/db_config.php index 8fa5f8c23..856b1226c 100644 --- a/cake/console/libs/tasks/db_config.php +++ b/cake/console/libs/tasks/db_config.php @@ -349,5 +349,25 @@ class DbConfigTask extends Shell { $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; + } } ?> \ No newline at end of file