mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 00:11:49 +02:00
For SQL debug, if we see an insert into alert_log with details column then we mask the output
This commit is contained in:
@@ -28,8 +28,13 @@ function dbQuery($sql, $parameters=array()) {
|
|||||||
$fullSql = dbMakeQuery($sql, $parameters);
|
$fullSql = dbMakeQuery($sql, $parameters);
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
||||||
|
if (preg_match('/(INSERT INTO `alert_log`).*(details)/i',$fullSql)) {
|
||||||
|
echo "\nINSERT INTO `alert_log` entry masked due to binary data\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$sql_debug[] = $fullSql;
|
$sql_debug[] = $fullSql;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,13 @@ function dbQuery($sql, $parameters=array()) {
|
|||||||
$fullSql = dbMakeQuery($sql, $parameters);
|
$fullSql = dbMakeQuery($sql, $parameters);
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
||||||
|
if (preg_match('/(INSERT INTO `alert_log`).*(details)/i',$fullSql)) {
|
||||||
|
echo "\nINSERT INTO `alert_log` entry masked due to binary data\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$sql_debug[] = $fullSql;
|
$sql_debug[] = $fullSql;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user