diff options
author | Andrew Dolgov <[email protected]> | 2013-02-27 15:33:54 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-02-27 15:33:54 +0400 |
commit | 65713fdf4cd1c376fa8780270bc78c3821ca7184 (patch) | |
tree | 3fad403d2e23cb0b5c41cc286ff23fbb52c341f2 | |
parent | 1b87341afae5d3cea8f03761c2b6aa912a09d584 (diff) |
log queries is QUERY_LOG is defined
-rw-r--r-- | include/db.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/db.php b/include/db.php index 7b2bd2a77..4e821105a 100644 --- a/include/db.php +++ b/include/db.php @@ -52,9 +52,11 @@ function db_escape_string($s, $strip_tags = true) { } function db_query($link, $query, $die_on_error = true) { - //if ($_REQUEST["qlog"]) - // error_log($_SESSION["uid"] . ":" . $_REQUEST["op"] . "/" . $_REQUEST["method"] . - // " $query\n", 3, "/tmp/ttrss-query.log"); + if ($_REQUEST["qlog"] || defined('QUERY_LOG')) { + $query = trim($query); + error_log($_SESSION["uid"] . ":" . $_REQUEST["op"] . "/" . $_REQUEST["method"] . + " $query\n", 3, "/tmp/ttrss-query.log"); + } if (DB_TYPE == "pgsql") { $result = pg_query($link, $query); |