Add ignore_errors option to rcube_db, so error logging can be disabled temporarily

Use ignore_errors to make sure the DDL upgrade errors are printed only once.
pull/5890/head
Aleksander Machniak 7 years ago
parent 147861ec37
commit 412163416e

@ -198,7 +198,10 @@ class rcmail_utils
echo "Updating database schema ($v)... ";
}
// Ignore errors here to print the error only once
$db->set_option('ignore_errors', true);
$error = self::db_update_schema($package, $v, "$dir/$v.sql");
$db->set_option('ignore_errors', false);
if ($error) {
if (!$opts['quiet']) {

@ -538,10 +538,12 @@ class rcube_db
$this->db_error = true;
$this->db_error_msg = sprintf('[%s] %s', $error[1], $error[2]);
rcube::raise_error(array('code' => 500, 'type' => 'db',
'line' => __LINE__, 'file' => __FILE__,
'message' => $this->db_error_msg . " (SQL Query: $query)"
), true, false);
if (empty($this->options['ignore_errors'])) {
rcube::raise_error(array(
'code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
'message' => $this->db_error_msg . " (SQL Query: $query)"
), true, false);
}
}
return false;

Loading…
Cancel
Save