better sql logging
This commit is contained in:
parent
1fc5fb755a
commit
e4b4bf2c8f
@ -570,11 +570,12 @@ class Database {
|
|||||||
if ((defined('DEBUG_SQL') && DEBUG_SQL === true) || (!defined('DEBUG_SQL') && @$_GET['DEBUG_SQL'])) {
|
if ((defined('DEBUG_SQL') && DEBUG_SQL === true) || (!defined('DEBUG_SQL') && @$_GET['DEBUG_SQL'])) {
|
||||||
$fp = @fopen("data/sql.log", "a");
|
$fp = @fopen("data/sql.log", "a");
|
||||||
if($fp) {
|
if($fp) {
|
||||||
if(isset($inputarray) && is_array($inputarray)) {
|
$sql = trim(preg_replace('/\s+/msi', ' ', $sql));
|
||||||
fwrite($fp, preg_replace('/\s+/msi', ' ', $sql)." -- ".join(", ", $inputarray)."\n");
|
if(isset($inputarray) && is_array($inputarray) && !empty($inputarray)) {
|
||||||
|
fwrite($fp, $sql." -- ".join(", ", $inputarray)."\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fwrite($fp, preg_replace('/\s+/msi', ' ', $sql)."\n");
|
fwrite($fp, $sql."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user