Skip to content

Commit

Permalink
SchemaShell always uses --file param when present.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
beporter committed Aug 11, 2014
1 parent ffefa64 commit f93029b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/Cake/Console/Command/SchemaShell.php
Expand Up @@ -66,13 +66,10 @@ public function startup() {
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';
Expand Down Expand Up @@ -483,7 +480,6 @@ public function getOptionParser() {
);
$file = array(
'help' => __d('cake_console', 'File name to read and write.'),
'default' => 'schema.php'
);
$name = array(
'help' => __d('cake_console',
Expand Down

0 comments on commit f93029b

Please sign in to comment.