Skip to content

Commit 8e7ddde

Browse files
author
Till Brehm
committed
Fixed #4939 unability to insert into sys_log is an iterative tipping point, stalling systems
Added a third parameter to $app->log() function in server part to turn off logging to database and use this option in mysql lib to not log any server side SQL errors to the database.
1 parent 03a40c7 commit 8e7ddde

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server/lib/app.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function load($classes) {
117117
2 = ERROR
118118
*/
119119

120-
function log($msg, $priority = 0) {
120+
function log($msg, $priority = 0, $dblog = true) {
121121

122122
global $conf;
123123

@@ -148,7 +148,7 @@ function log($msg, $priority = 0) {
148148
fclose($fp);
149149

150150
// Log to database
151-
if(isset($this->dbmaster)) {
151+
if($dblog === true && isset($this->dbmaster)) {
152152
$server_id = $conf['server_id'];
153153
$loglevel = $priority;
154154
$message = $msg;

server/lib/classes/db_mysql.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '', $bN
476476
if($this->show_error_messages && $conf['demo_mode'] === false) {
477477
echo $sErrormsg . $sAddMsg;
478478
} elseif(is_object($app) && method_exists($app, 'log') && $bNoLog == false) {
479-
$app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN);
479+
$app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN, false);
480480
} elseif(php_sapi_name() == 'cli') {
481481
echo $sErrormsg . $sAddMsg;
482482
}

0 commit comments

Comments
 (0)