Skip to content
Permalink
Browse files

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.
  • Loading branch information...
beporter committed Aug 11, 2014
1 parent ffefa64 commit f93029b29f01adc467e2007e8665913356624a56
Showing with 3 additions and 7 deletions.
  1. +3 −7 lib/Cake/Console/Command/SchemaShell.php
@@ -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';
@@ -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',

0 comments on commit f93029b

Please sign in to comment.
You can’t perform that action at this time.