Skip to content

Commit

Permalink
Removing while() loops wrapping in() with concrete options.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 21, 2009
1 parent 5843d5e commit fe2e3d8
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions cake/console/libs/tasks/db_config.php
Expand Up @@ -101,38 +101,31 @@ function __interactive() {
$this->out('The name must start with an unaccented latin character or an underscore');
}
}
$driver = '';

while ($driver == '') {
$driver = $this->in('Driver:', array('db2', 'firebird', 'mssql', 'mysql', 'mysqli', 'odbc', 'oracle', 'postgres', 'sqlite', 'sybase'), 'mysql');
}
$persistent = '';

while ($persistent == '') {
$persistent = $this->in('Persistent Connection?', array('y', 'n'), 'n');
}
$driver = $this->in('Driver:', array('db2', 'firebird', 'mssql', 'mysql', 'mysqli', 'odbc', 'oracle', 'postgres', 'sqlite', 'sybase'), 'mysql');

$persistent = $this->in('Persistent Connection?', array('y', 'n'), 'n');
if (low($persistent) == 'n') {
$persistent = 'false';
} else {
$persistent = 'true';
}
$host = '';

$host = '';
while ($host == '') {
$host = $this->in('Database Host:', null, 'localhost');
}
$port = '';

$port = '';
while ($port == '') {
$port = $this->in('Port?', null, 'n');
}

if (low($port) == 'n') {
$port = null;
}
$login = '';

$login = '';
while ($login == '') {
$login = $this->in('User:', null, 'root');
}
Expand All @@ -144,43 +137,39 @@ function __interactive() {

if ($password == '') {
$blank = $this->in('The password you supplied was empty. Use an empty password?', array('y', 'n'), 'n');
if ($blank == 'y')
{
if ($blank == 'y') {
$blankPassword = true;
}
}
}
$database = '';

$database = '';
while ($database == '') {
$database = $this->in('Database Name:', null, 'cake');
}
$prefix = '';

$prefix = '';
while ($prefix == '') {
$prefix = $this->in('Table Prefix?', null, 'n');
}

if (low($prefix) == 'n') {
$prefix = null;
}
$encoding = '';

$encoding = '';
while ($encoding == '') {
$encoding = $this->in('Table encoding?', null, 'n');
}

if (low($encoding) == 'n') {
$encoding = null;
}
$schema = '';

$schema = '';
if ($driver == 'postgres') {
while ($schema == '') {
$schema = $this->in('Table schema?', null, 'n');
}
}

if (low($schema) == 'n') {
$schema = null;
}
Expand Down

0 comments on commit fe2e3d8

Please sign in to comment.