mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Updated
This commit is contained in:
parent
1dcfa83a4f
commit
67e625e992
@ -123,7 +123,7 @@ class sql_db
|
||||
*/
|
||||
function connect ()
|
||||
{
|
||||
$this->cur_query = 'connect';
|
||||
$this->cur_query = "connect to: '{$this->cfg['dbhost']}'";
|
||||
$this->debug('start');
|
||||
|
||||
$connect_type = ($this->cfg['persist']) ? 'mysql_pconnect' : 'mysql_connect';
|
||||
@ -401,16 +401,11 @@ class sql_db
|
||||
if (!SQL_DEBUG) return;
|
||||
|
||||
if ($mode == 'start')
|
||||
{
|
||||
if (SQL_CALC_QUERY_TIME || DBG_LOG_TRACKER || SQL_LOG_SLOW_QUERIES)
|
||||
{
|
||||
$this->sql_starttime = utime();
|
||||
$this->sql_last_time = 0;
|
||||
}
|
||||
}
|
||||
elseif ($mode == 'end')
|
||||
{
|
||||
if (SQL_CALC_QUERY_TIME || DBG_LOG_TRACKER || SQL_LOG_SLOW_QUERIES)
|
||||
{
|
||||
$this->sql_last_time = utime() - $this->sql_starttime;
|
||||
$this->sql_timetotal += $this->sql_last_time;
|
||||
@ -428,7 +423,6 @@ class sql_db
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger error
|
||||
|
@ -93,7 +93,7 @@ class sql_db
|
||||
*/
|
||||
function connect ()
|
||||
{
|
||||
$this->cur_query = ($this->dbg_enabled) ? ($this->cfg['persist'] ? 'p' : '') . "connect to: {$this->cfg['dbhost']}" : 'connect';
|
||||
$this->cur_query = ($this->dbg_enabled) ? ($this->cfg['persist'] ? 'p' : '') . "connect to: '{$this->cfg['dbhost']}'" : 'connect';
|
||||
$this->debug('start');
|
||||
|
||||
$connect_type = ($this->cfg['persist']) ? 'mysql_pconnect' : 'mysql_connect';
|
||||
@ -747,11 +747,8 @@ class sql_db
|
||||
$dbg =& $this->dbg[$id];
|
||||
|
||||
if ($mode == 'start')
|
||||
{
|
||||
if (SQL_CALC_QUERY_TIME || DBG_LOG || SQL_LOG_SLOW_QUERIES)
|
||||
{
|
||||
$this->sql_starttime = utime();
|
||||
}
|
||||
if ($this->dbg_enabled)
|
||||
{
|
||||
$dbg['sql'] = preg_replace('#^(\s*)(/\*)(.*)(\*/)(\s*)#', '', $this->cur_query);
|
||||
@ -768,8 +765,6 @@ class sql_db
|
||||
}
|
||||
}
|
||||
else if ($mode == 'stop')
|
||||
{
|
||||
if (SQL_CALC_QUERY_TIME || DBG_LOG || SQL_LOG_SLOW_QUERIES)
|
||||
{
|
||||
$this->cur_query_time = utime() - $this->sql_starttime;
|
||||
$this->sql_timetotal += $this->cur_query_time;
|
||||
@ -779,7 +774,6 @@ class sql_db
|
||||
{
|
||||
$this->log_slow_query();
|
||||
}
|
||||
}
|
||||
if ($this->dbg_enabled)
|
||||
{
|
||||
$dbg['time'] = utime() - $this->sql_starttime;
|
||||
|
@ -47,8 +47,8 @@ function get_sql_log_html ($db_obj, $log_name)
|
||||
{
|
||||
$id = "sql_{$i}_". mt_rand();
|
||||
$sql = short_query($dbg['sql'], true);
|
||||
$time = sprintf('%.4f', $dbg['time']);
|
||||
$perc = @sprintf('[%d%%]', round($dbg['time']*100/$db_obj->sql_timetotal));
|
||||
$time = SQL_CALC_QUERY_TIME ? sprintf('%.4f', $dbg['time']) : '';
|
||||
$perc = SQL_CALC_QUERY_TIME ? @sprintf('[%d%%]', round($dbg['time']*100/$db_obj->sql_timetotal)) : '';
|
||||
$info = !empty($dbg['info']) ? $dbg['info'] .' ['. $dbg['src'] .']' : $dbg['src'];
|
||||
|
||||
$log .= ''
|
||||
|
@ -38,7 +38,7 @@ if ($show_dbg_info)
|
||||
if (!empty($DBS))
|
||||
{
|
||||
$sql_t = $DBS->sql_timetotal;
|
||||
$sql_time_txt = ($sql_t) ? sprintf('%.3f '.$lang['SEC'].' (%d%%) · ', $sql_t, round($sql_t*100/$gen_time)) : '';
|
||||
$sql_time_txt = ($sql_t && SQL_CALC_QUERY_TIME) ? sprintf('%.3f '.$lang['SEC'].' (%d%%) · ', $sql_t, round($sql_t*100/$gen_time)) : '';
|
||||
$num_q = $DBS->num_queries;
|
||||
$stat .= " | {$DBS->get_db_obj()->engine}: {$sql_time_txt}{$num_q} " . $lang['QUERIES'];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user