summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
*/