Skip to content
This repository was archived by the owner on Oct 25, 2022. It is now read-only.

Commit 8f47ed9

Browse files
committed
Merge branch 'master' of github.com:lonnieezell/codeigniter-forensics
2 parents c58132d + ebd6427 commit 8f47ed9

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

libraries/Profiler.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -187,35 +187,36 @@ protected function _compile_queries()
187187
// Key words we want bolded
188188
$highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')');
189189

190+
191+
$total = 0; // total query time
190192
foreach ($dbs as $db)
191193
{
192-
if (count($db->queries) == 0)
193-
{
194-
$output = $this->CI->lang->line('profiler_no_queries');
195-
}
196-
else
194+
195+
foreach ($db->queries as $key => $val)
197196
{
198-
$total = 0; // total query time
197+
$time = number_format($db->query_times[$key], 4);
198+
$total += $db->query_times[$key];
199199

200-
foreach ($db->queries as $key => $val)
200+
foreach ($highlight as $bold)
201201
{
202-
$time = number_format($db->query_times[$key], 4);
203-
$total += $db->query_times[$key];
204-
205-
foreach ($highlight as $bold)
206-
{
207-
$val = str_replace($bold, '<b>'. $bold .'</b>', $val);
208-
}
209-
210-
$output[][$time] = $val;
202+
$val = str_replace($bold, '<b>'. $bold .'</b>', $val);
211203
}
212204

213-
$total = number_format($total, 4);
214-
$output[][$total] = 'Total Query Execution Time';
205+
$output[][$time] = $val;
215206
}
216207

217208
}
218209

210+
if(count($output) == 0)
211+
{
212+
$output = $this->CI->lang->line('profiler_no_queries');
213+
}
214+
else
215+
{
216+
$total = number_format($total, 4);
217+
$output[][$total] = 'Total Query Execution Time';
218+
}
219+
219220
return $output;
220221
}
221222

@@ -556,4 +557,4 @@ public function run()
556557
//--------------------------------------------------------------------
557558

558559
/* End of file Profiler.php */
559-
/* Location: ./system/libraries/Profiler.php */
560+
/* Location: ./system/libraries/Profiler.php */

0 commit comments

Comments
 (0)