DB/Errors

* don't need to handle sql warnings in batch when the error handler doesn't use exit() any longer
 * display warnings as [WARN] and use consts instead of magic numbers
This commit is contained in:
Sarjuuk
2024-05-26 18:25:05 +02:00
parent 2d5caba814
commit 454e09cc78
2 changed files with 2 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ set_error_handler(function($errNo, $errStr, $errFile, $errLine)
Util::addNote($uGroup, $errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine);
if (CLI)
CLI::write($errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine, $errNo & 0x40A ? CLI::LOG_WARN : CLI::LOG_ERROR);
CLI::write($errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine, $errNo & (E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE) ? CLI::LOG_WARN : CLI::LOG_ERROR);
if (DB::isConnected(DB_AOWOW))
DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()',

View File

@@ -169,7 +169,7 @@ class DbSimple_Mysqli extends DbSimple_Database
if ($this->link->warning_count) {
if ($warn = $this->link->query("SHOW WARNINGS")) {
while ($warnRow = $warn->fetch_row())
if ($warnRow[0] !== 'Note')
if ($warnRow[0] === 'Warning')
$this->_setLastError(-$warnRow[1], $warnRow[2], $queryMain[0]);
$warn->close();