Index: branches/5.2.x/core/units/helpers/deployment_helper.php =================================================================== --- branches/5.2.x/core/units/helpers/deployment_helper.php +++ branches/5.2.x/core/units/helpers/deployment_helper.php @@ -530,7 +530,7 @@ $sqls = array_map('trim', $sqls); try { - foreach ($sqls as $sql) { + foreach ( $sqls as $line_number => $sql ) { if ( substr($sql, 0, 1) == '#' ) { // output comment as is $this->toLog($sql); @@ -553,6 +553,26 @@ // consider revisions with errors applied $this->appliedRevisions[] = $revision; + $this->out('========', true); + $this->toLog('========'); + + foreach ( array_slice($sqls, $line_number) as $sql ) { + if ( substr($sql, 0, 1) == '#' ) { + // Output comment as is. + $this->toLog($sql); + echo $this->colorText($sql, 'purple') . PHP_EOL; + continue; + } + elseif ( $sql ) { + $this->toLog($sql); + $escaped_sql = $this->isCommandLine ? $sql : kUtil::escape($sql); + echo $escaped_sql . ';' . PHP_EOL; + } + } + + $this->out('========', true); + $this->toLog('========'); + return false; } @@ -576,10 +596,14 @@ */ public function handleSqlError($code, $msg, $sql) { - $this->toLog('FAILED' . PHP_EOL . 'SQL Error #' . $code . ': ' . $msg); - - $this->displayStatus('FAILED' . PHP_EOL . 'SQL Error #' . $code . ': ' . $msg); - $this->out('Please execute rest of SQLs in this Revision by hand and run deployment script again.', true); + $error_msg = 'FAILED' . PHP_EOL . 'SQL Error #' . $code . ': ' . $msg; + $this->toLog($error_msg); + $this->displayStatus($error_msg); + + $info_msg = 'Execute rest of SQLs in this Revision (show below) by hand and '; + $info_msg .= 'RUN deployment script again to complete the deployment process.'; + $this->toLog($info_msg); + echo $this->colorText($info_msg, 'red', true) . PHP_EOL; throw new Exception($msg, $code); }