Index: branches/5.3.x/core/units/helpers/deployment_helper.php =================================================================== diff -u -N -r16094 -r16111 --- branches/5.3.x/core/units/helpers/deployment_helper.php (.../deployment_helper.php) (revision 16094) +++ branches/5.3.x/core/units/helpers/deployment_helper.php (.../deployment_helper.php) (revision 16111) @@ -1,6 +1,6 @@ dryRun ) { - $this->exportLanguagePack(); + try { + if ( $this->dryRun ) { + $this->exportLanguagePack(); + } + else { + $this->importLanguagePack(); + } } - else { - $this->importLanguagePack(); + catch ( Exception $e ) { + echo $this->colorText('Failed with Module "' . $module_name . '".', 'red', true) . PHP_EOL . PHP_EOL; + + return false; } echo $this->colorText('Done with Module "' . $module_name . '".', 'green', true) . PHP_EOL . PHP_EOL; @@ -509,29 +516,29 @@ $this->initLog($revision); - foreach ( $sqls as $sql ) { - if ( substr($sql, 0, 1) == '#' ) { - // output comment as is - echo $this->toLog($this->colorText($sql, 'purple')); + try { + foreach ( $sqls as $sql ) { + if ( substr($sql, 0, 1) == '#' ) { + // output comment as is + echo $this->toLog($this->colorText($sql, 'purple')); - continue; - } - elseif ( $sql ) { - echo $this->toLog($this->shortenQuery($sql), false); - $this->Conn->Query($sql); - - if ( $this->Conn->hasError() ) { - // consider revisions with errors applied - $this->saveLog(ModuleDeploymentLog::STATUS_ERROR); - - return false; + continue; } - else { + elseif ( $sql ) { + echo $this->toLog($this->shortenQuery($sql), false); + $this->Conn->Query($sql); + $this->displayStatus('OK (' . $this->Conn->getAffectedRows() . ')', true, true); } } } + catch ( Exception $e ) { + // consider revisions with errors applied + $this->saveLog(ModuleDeploymentLog::STATUS_ERROR); + return false; + } + $this->saveLog(ModuleDeploymentLog::STATUS_SUCCESS); } @@ -606,7 +613,8 @@ * @param string $msg Error message. * @param string $sql SQL query, that raised an error. * - * @return boolean + * @return void + * @throws Exception When SQL error happens. */ public function handleSqlError($code, $msg, $sql) { @@ -618,7 +626,7 @@ $this->out('Please execute rest of SQLs in this Revision by hand and run deployment script again.', true); - return true; + throw new Exception($msg, $code); } /**