mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
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
This commit is contained in:
@@ -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";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user