Browse Source

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.
Brian Porter 11 years ago
parent
commit
f93029b29f
1 changed files with 3 additions and 7 deletions
  1. 3 7
      lib/Cake/Console/Command/SchemaShell.php

+ 3 - 7
lib/Cake/Console/Command/SchemaShell.php

@@ -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',