mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #327 from bigclick/patch-1
Fix for when trying to use "Console/cake schema generate snapshot"
This commit is contained in:
commit
340d112693
1 changed files with 6 additions and 6 deletions
|
@ -64,7 +64,7 @@ class SchemaShell extends Shell {
|
||||||
$name = $path = $connection = $plugin = null;
|
$name = $path = $connection = $plugin = null;
|
||||||
if (!empty($this->params['name'])) {
|
if (!empty($this->params['name'])) {
|
||||||
$name = $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];
|
$name = $this->params['name'] = $this->args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ class SchemaShell extends Shell {
|
||||||
Configure::write('Cache.disable', $cacheDisable);
|
Configure::write('Cache.disable', $cacheDisable);
|
||||||
|
|
||||||
if ($snapshot === true) {
|
if ($snapshot === true) {
|
||||||
|
$fileName = rtrim($this->params['file'], '.php');
|
||||||
$Folder = new Folder($this->Schema->path);
|
$Folder = new Folder($this->Schema->path);
|
||||||
$result = $Folder->read();
|
$result = $Folder->read();
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ class SchemaShell extends Shell {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
if (!empty($result[1])) {
|
if (!empty($result[1])) {
|
||||||
foreach ($result[1] as $file) {
|
foreach ($result[1] as $file) {
|
||||||
if (preg_match('/schema(?:[_\d]*)?\.php$/', $file)) {
|
if (preg_match('/'.preg_quote($fileName).'(?:[_\d]*)?\.php$/', $file)) {
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +182,6 @@ class SchemaShell extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = rtrim($this->params['file'], '.php');
|
|
||||||
$content['file'] = $fileName . '_' . $count . '.php';
|
$content['file'] = $fileName . '_' . $count . '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue