Skip to content

Commit

Permalink
fix for terminate command
Browse files Browse the repository at this point in the history
  • Loading branch information
detain committed Aug 28, 2017
1 parent 52ecba6 commit 931b5ef
Showing 1 changed file with 13 additions and 36 deletions.
49 changes: 13 additions & 36 deletions src/Pgsql/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,43 +572,20 @@ public function halt($msg, $line = '', $file = '') {
/* Just in case there is a table currently locked */
$this->transaction_abort();

if ($this->xmlrpc || $this->soap) {
$s = sprintf("Database error: %s\n", $msg);
$s .= sprintf("PostgreSQL Error: %s\n\n (%s)\n\n", $this->Errno, $this->Error);
} else {
$s = sprintf("<b>Database error:</b> %s<br>\n", $msg);
$s .= sprintf("<b>PostgreSQL Error</b>: %s (%s)<br>\n", $this->Errno, $this->Error);
}

if ($file) {
if ($this->xmlrpc || $this->soap) {
$s .= sprintf("File: %s\n", $file);
} else {
$s .= sprintf('<br><b>File:</b> %s', $file);
}
}

if ($line) {
if ($this->xmlrpc || $this->soap) {
$s .= sprintf("Line: %s\n", $line);
} else {
$s .= sprintf('<br><b>Line:</b> %s', $line);
}
}

if ($this->haltOnError == 'yes') {
$s = sprintf("Database error: %s\n", $msg);
$s .= sprintf("PostgreSQL Error: %s\n\n (%s)\n\n", $this->Errno, $this->Error);

if ($file)
$s .= sprintf("File: %s\n", $file);
if ($line)
$s .= sprintf("Line: %s\n", $line);
if ($this->haltOnError == 'yes')
$s .= '<p><b>Session halted.</b>';
}

if ($this->xmlrpc) {
xmlrpcfault($s);
} elseif ($this->soap) {

} else {
error_log($s);
if (isset($GLOBALS['tf']))
$GLOBALS['tf']->terminate();
}
error_log($s);
echo $s;
if (isset($GLOBALS['tf']))
$GLOBALS['tf']->terminate();
die($s);
}

/**
Expand Down

0 comments on commit 931b5ef

Please sign in to comment.