-
Notifications
You must be signed in to change notification settings - Fork 0
/
MY_Profiler.php
50 lines (39 loc) · 1.34 KB
/
MY_Profiler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
class MY_Profiler extends CI_Profiler
{
protected $_available_sections = array(
'benchmarks',
'get',
'memory_usage',
'post',
'uri_string',
'controller_info',
'queries',
'dibi',
'http_headers',
'config',
);
// --------------------------------------------------------------------
/**
* Compile Queries
*
* @return string
*/
protected function _compile_dibi()
{
// Load the text helper so we can highlight the SQL
$this->CI->load->helper('text');
// Key words we want bolded
$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', '(', ')');
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #0000FF;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#0000FF;"> DiBi log ('.dibi::$numOfQueries.' queries, time: '.sprintf('%0.3f',dibi::$totalTime).'s) </legend>';
$output .= "\n";
$output .= "\n\n<table style='width:100%;'>\n";
$output .= dibi::getProfiler()->getHtml();
$output .= "</table>\n";
$output .= "</fieldset>";
return $output;
}
}