From: Andrew Dolgov Date: Wed, 27 Feb 2013 11:33:54 +0000 (+0400) Subject: log queries is QUERY_LOG is defined X-Git-Tag: 1.7.1~27 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=65713fdf4cd1c376fa8780270bc78c3821ca7184;p=tt-rss.git log queries is QUERY_LOG is defined --- diff --git a/include/db.php b/include/db.php index 7b2bd2a7..4e821105 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);