aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-01-03 19:47:36 +0000
committerz0rglub <z0rglub@piwigo.org>2004-01-03 19:47:36 +0000
commit40acb0f99fe7fad6ee3231c653811e5453d3a844 (patch)
tree11287d53db265d32842b4f9c804ba98d4795bae0 /include/functions.inc.php
parent49b99ad40c86acae6ed781bc36040916cac79e73 (diff)
add functions pwg_write_debug, pwg_debug, pwg_query
git-svn-id: http://piwigo.org/svn/branches/release-1_3@243 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 5eeb2f4a7..8f0011756 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -423,4 +423,47 @@ function notify( $type, $infos = '' )
@mail( $to, $subject, $content, $headers, $options );
}
}
+
+function pwg_write_debug()
+{
+ global $debug;
+
+ $fp = @fopen( './log/debug.log', 'a+' );
+ fwrite( $fp, "\n\n" );
+ fwrite( $fp, $debug );
+ fclose( $fp );
+}
+
+function pwg_query( $query )
+{
+ global $count_queries,$queries_time;
+
+ $start = get_moment();
+ $output = '';
+
+ $count_queries++;
+ $output.= '<br /><br />['.$count_queries.'] '.$query;
+ $result = mysql_query( $query );
+ $time = get_moment() - $start;
+ $queries_time+= $time;
+ $output.= '<b>('.number_format( $time, 3, '.', ' ').' s)</b>';
+ $output.= '('.number_format( $queries_time, 3, '.', ' ').' s)';
+
+ // echo $output;
+
+ return $result;
+}
+
+function pwg_debug( $string )
+{
+ global $debug,$t2,$count_queries;
+
+ $now = explode( ' ', microtime() );
+ $now2 = explode( '.', $now[0] );
+ $now2 = $now[1].'.'.$now2[1];
+ $time = number_format( $now2 - $t2, 3, '.', ' ').' s';
+ $debug.= '['.$time.', ';
+ $debug.= $count_queries.' queries] : '.$string;
+ $debug.= "\n";
+}
?> \ No newline at end of file