mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Adding getConfig() so other tasks can pick connections more easily.
This commit is contained in:
parent
b5cc69c37c
commit
802ed73c0a
1 changed files with 20 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue