Commit b1bdd4ac authored by Dries's avatar Dries
Browse files

- Patch #41870 by fgm: improved debugging support.

parent 68820e23
...@@ -101,6 +101,8 @@ function _db_query($query, $debug = 0) { ...@@ -101,6 +101,8 @@ function _db_query($query, $debug = 0) {
$result = mysql_query($query, $active_db); $result = mysql_query($query, $active_db);
if (variable_get('dev_query', 0)) { if (variable_get('dev_query', 0)) {
$bt = debug_backtrace();
$query = $bt[2]['function'] . "\n" . $query;
list($usec, $sec) = explode(' ', microtime()); list($usec, $sec) = explode(' ', microtime());
$stop = (float)$usec + (float)$sec; $stop = (float)$usec + (float)$sec;
$diff = $stop - $timer; $diff = $stop - $timer;
......
...@@ -102,6 +102,8 @@ function _db_query($query, $debug = 0) { ...@@ -102,6 +102,8 @@ function _db_query($query, $debug = 0) {
$result = mysqli_query($active_db, $query); $result = mysqli_query($active_db, $query);
if (variable_get('dev_query', 0)) { if (variable_get('dev_query', 0)) {
$bt = debug_backtrace();
$query = $bt[2]['function'] . "\n" . $query;
list($usec, $sec) = explode(' ', microtime()); list($usec, $sec) = explode(' ', microtime());
$stop = (float)$usec + (float)$sec; $stop = (float)$usec + (float)$sec;
$diff = $stop - $timer; $diff = $stop - $timer;
......
...@@ -84,6 +84,8 @@ function _db_query($query, $debug = 0) { ...@@ -84,6 +84,8 @@ function _db_query($query, $debug = 0) {
$last_result = pg_query($active_db, $query); $last_result = pg_query($active_db, $query);
if (variable_get('dev_query', 0)) { if (variable_get('dev_query', 0)) {
$bt = debug_backtrace();
$query = $bt[2]['function'] . "\n" . $query;
list($usec, $sec) = explode(' ', microtime()); list($usec, $sec) = explode(' ', microtime());
$stop = (float)$usec + (float)$sec; $stop = (float)$usec + (float)$sec;
$diff = $stop - $timer; $diff = $stop - $timer;
......
...@@ -53,8 +53,8 @@ function sess_write($key, $value) { ...@@ -53,8 +53,8 @@ function sess_write($key, $value) {
$result = db_query("SELECT sid FROM {sessions} WHERE sid = '%s'", $key); $result = db_query("SELECT sid FROM {sessions} WHERE sid = '%s'", $key);
if (!db_num_rows($result)) { if (!db_num_rows($result)) {
// Only save session data when when the browser sends a cookie. This keeps // Only save session data when when the browser sends a cookie. This keeps
// crawlers out of session table. This improves speed up queries, reduces // crawlers out of session table. This improves speed up queries, reduces
// memory, and gives more useful statistics. We can't eliminate anonymous // memory, and gives more useful statistics. We can't eliminate anonymous
// session table rows without breaking throttle modulee and "Who's Online" // session table rows without breaking throttle modulee and "Who's Online"
// block. // block.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment