Changeset View
Changeset View
Standalone View
Standalone View
core/units/helpers/deployment_helper.php
Show First 20 Lines • Show All 665 Lines • ▼ Show 20 Line(s) | |||||
$ret[] = $real_seconds . 's'; | $ret[] = $real_seconds . 's'; | ||||
return implode(' ', $ret); | return implode(' ', $ret); | ||||
} | } | ||||
/** | /** | ||||
* Error handler for sql errors. | * Error handler for sql errors. | ||||
* | * | ||||
* @param integer $code Error code. | * @param integer $code Error code. | ||||
* @param string $msg Error message. | * @param string $msg Error message. | ||||
* @param string $sql SQL query. | * @param string $sql SQL query. | ||||
* @param boolean|null $throw_exception Throw an exception. | |||||
* | * | ||||
* @return void | * @return void | ||||
* @throws Exception When SQL error happens. | * @throws Exception When SQL error happens. | ||||
* @throws RuntimeException When requested. | |||||
*/ | */ | ||||
public function handleSqlError($code, $msg, $sql) | public function handleSqlError($code, $msg, $sql, $throw_exception = null) | ||||
{ | { | ||||
$error_msg = 'FAILED' . PHP_EOL . 'SQL Error #' . $code . ': ' . $msg; | $error_msg = 'FAILED' . PHP_EOL . 'SQL Error #' . $code . ': ' . $msg; | ||||
if ( $throw_exception === true ) { | |||||
throw new RuntimeException($error_msg); | |||||
} | |||||
$this->toLog($error_msg); | $this->toLog($error_msg); | ||||
$this->displayStatus($error_msg); | $this->displayStatus($error_msg); | ||||
$info_msg = 'Execute rest of SQLs in this Revision (show below) by hand and '; | $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.'; | $info_msg .= 'RUN deployment script again to complete the deployment process.'; | ||||
$this->toLog($info_msg); | $this->toLog($info_msg); | ||||
echo $this->colorText($info_msg, 'red', true) . PHP_EOL; | echo $this->colorText($info_msg, 'red', true) . PHP_EOL; | ||||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |