Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for when trying to use "Console/cake schema generate snapshot" co…

…mmand, line 67 was making the name param snapshot, also fixed auto numbering in the case where the filename wasn't "schema"
  • Loading branch information...
commit 7a68f7fed163a51d649cb14d960007d470610cac 1 parent de5a4ea
bigclick authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/Cake/Console/Command/SchemaShell.php
View
12 lib/Cake/Console/Command/SchemaShell.php
@@ -64,7 +64,7 @@ public function startup() {
$name = $path = $connection = $plugin = null;
if (!empty($this->params['name'])) {
$name = $this->params['name'];
- } elseif (!empty($this->args[0])) {
+ } elseif (!empty($this->args[0]) && $this->args[0] !== 'snapshot') {
$name = $this->params['name'] = $this->args[0];
}
@@ -158,6 +158,7 @@ public function generate() {
Configure::write('Cache.disable', $cacheDisable);
if ($snapshot === true) {
+ $fileName = rtrim($this->params['file'], '.php');
$Folder = new Folder($this->Schema->path);
$result = $Folder->read();
@@ -165,11 +166,11 @@ public function generate() {
if (isset($this->params['snapshot'])) {
$numToUse = $this->params['snapshot'];
}
-
+
$count = 0;
if (!empty($result[1])) {
foreach ($result[1] as $file) {
- if (preg_match('/schema(?:[_\d]*)?\.php$/', $file)) {
+ if (preg_match('/'.$fileName.'(?:[_\d]*)?\.php$/', $file)) {
$count++;
}
}
@@ -180,8 +181,7 @@ public function generate() {
$count = $numToUse;
}
}
-
- $fileName = rtrim($this->params['file'], '.php');
+
$content['file'] = $fileName . '_' . $count . '.php';
}
@@ -530,4 +530,4 @@ public function getOptionParser() {
));
return $parser;
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.