SchemaShell always uses --file param when present.

Addresses **part** of the problem described in #4174.

Corrects SchemaShell's startup logic so that when a `--file` param is provided by the user, it is always used even in the case that it matches the default file name (schema.php). This solves a problem when a user wishes to provide a classname using `--name`, but still wants to use the default filename.
This commit is contained in:
Brian Porter 2014-08-11 09:08:59 -05:00
parent ffefa6425f
commit f93029b29f

View file

@ -66,13 +66,10 @@ class SchemaShell extends AppShell {
list($this->params['plugin'], $splitName) = pluginSplit($name);
$name = $this->params['name'] = $splitName;
}
$defaultFile = 'schema.php';
if (empty($this->params['file'])) {
$this->params['file'] = $defaultFile;
}
if ($name && $this->params['file'] === $defaultFile) {
if ($name && empty($this->params['file']) {
$this->params['file'] = Inflector::underscore($name);
} else {
$this->params['file'] = 'schema.php';
}
if (strpos($this->params['file'], '.php') === false) {
$this->params['file'] .= '.php';
@ -483,7 +480,6 @@ class SchemaShell extends AppShell {
);
$file = array(
'help' => __d('cake_console', 'File name to read and write.'),
'default' => 'schema.php'
);
$name = array(
'help' => __d('cake_console',