Removing while() loops wrapping in() with concrete options.

This commit is contained in:
mark_story 2009-05-20 23:21:36 -04:00
parent 5843d5e40a
commit fe2e3d82fd

View file

@ -101,29 +101,22 @@ class DbConfigTask extends Shell {
$this->out('The name must start with an unaccented latin character or an underscore'); $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');
$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');
}
$persistent = $this->in('Persistent Connection?', array('y', 'n'), 'n');
if (low($persistent) == 'n') { if (low($persistent) == 'n') {
$persistent = 'false'; $persistent = 'false';
} else { } else {
$persistent = 'true'; $persistent = 'true';
} }
$host = '';
$host = '';
while ($host == '') { while ($host == '') {
$host = $this->in('Database Host:', null, 'localhost'); $host = $this->in('Database Host:', null, 'localhost');
} }
$port = '';
$port = '';
while ($port == '') { while ($port == '') {
$port = $this->in('Port?', null, 'n'); $port = $this->in('Port?', null, 'n');
} }
@ -131,8 +124,8 @@ class DbConfigTask extends Shell {
if (low($port) == 'n') { if (low($port) == 'n') {
$port = null; $port = null;
} }
$login = '';
$login = '';
while ($login == '') { while ($login == '') {
$login = $this->in('User:', null, 'root'); $login = $this->in('User:', null, 'root');
} }
@ -144,43 +137,39 @@ class DbConfigTask extends Shell {
if ($password == '') { if ($password == '') {
$blank = $this->in('The password you supplied was empty. Use an empty password?', array('y', 'n'), 'n'); $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; $blankPassword = true;
} }
} }
} }
$database = '';
$database = '';
while ($database == '') { while ($database == '') {
$database = $this->in('Database Name:', null, 'cake'); $database = $this->in('Database Name:', null, 'cake');
} }
$prefix = '';
$prefix = '';
while ($prefix == '') { while ($prefix == '') {
$prefix = $this->in('Table Prefix?', null, 'n'); $prefix = $this->in('Table Prefix?', null, 'n');
} }
if (low($prefix) == 'n') { if (low($prefix) == 'n') {
$prefix = null; $prefix = null;
} }
$encoding = '';
$encoding = '';
while ($encoding == '') { while ($encoding == '') {
$encoding = $this->in('Table encoding?', null, 'n'); $encoding = $this->in('Table encoding?', null, 'n');
} }
if (low($encoding) == 'n') { if (low($encoding) == 'n') {
$encoding = null; $encoding = null;
} }
$schema = '';
$schema = '';
if ($driver == 'postgres') { if ($driver == 'postgres') {
while ($schema == '') { while ($schema == '') {
$schema = $this->in('Table schema?', null, 'n'); $schema = $this->in('Table schema?', null, 'n');
} }
} }
if (low($schema) == 'n') { if (low($schema) == 'n') {
$schema = null; $schema = null;
} }