Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F803923
D406.id1051.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:01 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:01 AM (4 h, 48 m)
Engine
blob
Format
Raw Data
Handle
576643
Attached To
D406: INP-1803 - Show non-executed SQLs during deployment
D406.id1051.diff
View Options
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);
}
Event Timeline
Log In to Comment