summaryrefslogtreecommitdiffstats
path: root/include/db.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2009-03-29 11:13:59 -0700
committerArun Persaud <arun@nubati.net>2009-03-29 11:13:59 -0700
commit4209593d06a237995d8cc0ba527188a15cbd0376 (patch)
treef1c1d01bf5634f4595bd004446778f84b007c629 /include/db.php
parente3b15417c99b27677a56eae5d26779f90b48adf8 (diff)
downloade-DoKo-4209593d06a237995d8cc0ba527188a15cbd0376.tar.gz
e-DoKo-4209593d06a237995d8cc0ba527188a15cbd0376.tar.bz2
e-DoKo-4209593d06a237995d8cc0ba527188a15cbd0376.zip
CLEANUP: better debugging option for DB querries
add option to only log querries that take a long time
Diffstat (limited to 'include/db.php')
-rw-r--r--include/db.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/db.php b/include/db.php
index da005a1..e389db4 100644
--- a/include/db.php
+++ b/include/db.php
@@ -59,16 +59,17 @@ function DB_test()
function DB_query($query)
{
/* debug/optimize the database
- $logfile=fopen('/tmp/DBlog.log','a+');
- fwrite($logfile,"EXPLAIN $query ;\n");
-
$time = microtime();
$return = mysql_query($query);
$time = $time - microtime();
- fwrite($logfile,"time of above query: $time\n");
-
- fclose($logfile);
+ if($time > 0.05) // this way we can find only the long ones
+ {
+ $logfile=fopen('/tmp/DBlog.log','a+');
+ fwrite($logfile,"EXPLAIN $query ;\n");
+ fwrite($logfile,"time of above query: $time\n");
+ fclose($logfile);
+ };
return $return;
*/