mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Updating Schema shell so before() and after() are properly triggered. Fixes #5918
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7952 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
61850b1be1
commit
0c29a7e1b1
1 changed files with 6 additions and 6 deletions
|
@ -305,7 +305,7 @@ class SchemaShell extends Shell {
|
|||
|
||||
if ('y' == $this->in(__('Are you sure you want to drop the table(s)?', true), array('y', 'n'), 'n')) {
|
||||
$this->out('Dropping table(s).');
|
||||
$this->__run($drop, 'drop');
|
||||
$this->__run($drop, 'drop', $Schema);
|
||||
}
|
||||
|
||||
$this->out("\n" . __('The following table(s) will be created.', true));
|
||||
|
@ -313,7 +313,7 @@ class SchemaShell extends Shell {
|
|||
|
||||
if ('y' == $this->in(__('Are you sure you want to create the table(s)?', true), array('y', 'n'), 'y')) {
|
||||
$this->out('Creating table(s).');
|
||||
$this->__run($create, 'create');
|
||||
$this->__run($create, 'create', $Schema);
|
||||
}
|
||||
|
||||
$this->out(__('End create.', true));
|
||||
|
@ -351,7 +351,7 @@ class SchemaShell extends Shell {
|
|||
if ('y' == $this->in(__('Are you sure you want to alter the tables?', true), array('y', 'n'), 'n')) {
|
||||
$this->out('');
|
||||
$this->out(__('Updating Database...', true));
|
||||
$this->__run($contents, 'update');
|
||||
$this->__run($contents, 'update', $Schema);
|
||||
}
|
||||
|
||||
$this->out(__('End update.', true));
|
||||
|
@ -361,7 +361,7 @@ class SchemaShell extends Shell {
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
function __run($contents, $event) {
|
||||
function __run($contents, $event, $Schema) {
|
||||
if (empty($contents)) {
|
||||
$this->err(__('Sql could not be run', true));
|
||||
return;
|
||||
|
@ -379,14 +379,14 @@ class SchemaShell extends Shell {
|
|||
$this->out(sprintf(__('Dry run for %s :', true), $table));
|
||||
$this->out($sql);
|
||||
} else {
|
||||
if (!$this->Schema->before(array($event => $table))) {
|
||||
if (!$Schema->before(array($event => $table))) {
|
||||
return false;
|
||||
}
|
||||
if (!$db->_execute($sql)) {
|
||||
$error = $table . ': ' . $db->lastError();
|
||||
}
|
||||
|
||||
$this->Schema->after(array($event => $table, 'errors'=> $errors));
|
||||
$Schema->after(array($event => $table, 'errors'=> $errors));
|
||||
|
||||
if (isset($error)) {
|
||||
$this->out($error);
|
||||
|
|
Loading…
Add table
Reference in a new issue