diff options
author | friendica <info@friendica.com> | 2012-07-18 17:08:03 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-07-18 17:08:03 -0700 |
commit | d92a4a686dd989613cfb628896902c7a4f21c522 (patch) | |
tree | 6e255cfe2108602c32b40d9d4c424f790176467e /include/dba.php | |
parent | 0400779b43525de44dab7d076aa184d634aba0f2 (diff) | |
download | volse-hubzilla-d92a4a686dd989613cfb628896902c7a4f21c522.tar.gz volse-hubzilla-d92a4a686dd989613cfb628896902c7a4f21c522.tar.bz2 volse-hubzilla-d92a4a686dd989613cfb628896902c7a4f21c522.zip |
eliminate the obsolete "last-child" indicator
Diffstat (limited to 'include/dba.php')
-rw-r--r-- | include/dba.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/dba.php b/include/dba.php index 71c1ba859..879d7e67e 100644 --- a/include/dba.php +++ b/include/dba.php @@ -71,22 +71,32 @@ class dba { } public function q($sql) { + global $a; if((! $this->db) || (! $this->connected)) return false; $this->error = ''; - //if (get_config("system", "db_log") != "") - // @file_put_contents(get_config("system", "db_log"), datetime_convert().':'.session_id(). ' Start '.$sql."\n", FILE_APPEND); + if ($a->config["system"]["db_log"] != "") + $stamp1 = microtime(true); if($this->mysqli) $result = @$this->db->query($sql); else $result = @mysql_query($sql,$this->db); - //if (get_config("system", "db_log") != "") - // @file_put_contents(get_config("system", "db_log"), datetime_convert().':'.session_id(). ' Stop '."\n", FILE_APPEND); + if ($a->config["system"]["db_log"] != "") { + $stamp2 = microtime(true); + $duration = round($stamp2-$stamp1, 3); + if ($duration > $a->config["system"]["db_loglimit"]) { + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + @file_put_contents($a->config["system"]["db_log"], $duration."\t". + basename($backtrace[1]["file"])."\t". + $backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t". + substr($sql, 0, 2000)."\n", FILE_APPEND); + } + } if($this->mysqli) { if($this->db->errno) |