nohtml = 1;
$percent = round(($this->db->querytime / $totaltime) * 100, 1);
if (($query = substr($this->query, 0, -12)))
$normview = $this->self . '?' . $query;
else
$normview = $this->self;
$out = "
PDNS-Admin Debug
PDNS-Admin Debug";
if (!$this->debug_mode) {
$out .= "
This feature has been disabled.
";
return;
}
$out .= "
Jump to statistics - Back to normal view
| query |
execution time |
table(s) |
type |
possible keys |
key |
key length |
ref |
rows |
extra |
";
foreach ($this->db->querydebug as $debug) {
unset($table, $type, $key, $key_len, $ref, $rows, $Extra, $possible_keys);
extract($debug);
$querytime = round($querytime, 8);
$danger = 1;
if (empty($table)) $table = '';
if (empty($type)) $type = '';
if (empty($key)) $key = '';
if (empty($key_len)) $key_len = '';
if (empty($ref)) $ref = '';
if (empty($rows)) $rows = '';
if (empty($Extra)) $Extra = '';
if (empty($possible_keys)) $possible_keys = '';
if ($querytime > 0.05) $danger++;
if ($querytime > 0.1) $danger++;
if ($querytime > 1) $danger++;
if ($type == 'ALL') $danger++;
if ($type == 'index') $danger++;
if ($type == 'range') $danger++;
if ($type == 'ref') $danger++;
if ($rows >= 200) $danger++;
if (!empty($possible_keys) && empty($key)) {
$danger++;
}
if ((strpos($Extra, 'Using filesort') !== false) || (strpos($Extra, 'Using temporary') !== false)) {
$danger++;
}
switch($danger)
{
case 1: $color = '#dadada'; break;
case 2: $color = '#dad0d0'; break;
case 3: $color = '#dacaca'; break;
case 4: $color = '#dac0c0'; break;
case 5: $color = '#dababa'; break;
case 6: $color = '#dab0b0'; break;
case 7: $color = '#daaaaa'; break;
case 8: $color = '#da9090'; break;
case 9: $color = '#da8a8a'; break;
default: $color = '#ff0000'; break;
}
preg_match("/(FROM|UPDATE) (\w+)/i", $query, $table);
$out .= "
" . wordwrap(trim(str_replace("\t", '', $query))) . " |
$querytime |
{$table[2]} |
$type |
$possible_keys |
$key |
$key_len |
$ref |
$rows |
Intensity $danger" . (empty($Extra) ? '' : "; $Extra") . ' |
';
}
$this->db->querytime = round($this->db->querytime, 5);
$tempcount = count($this->templater->temps);
$langcount = count(get_object_vars($this->lang));
$out .= "
Query Server Intensity:
1
2
3
4
5
6
7
8
9
MySQL queries: {$this->db->querycount}
Server Load: $load
Execution Time: $totaltime
Query Time: {$this->db->querytime} ($percent% of total execution time)
Loaded Language: " . get_class($this->lang) . "
Loaded Words: $langcount
";
$out .= "$tempcount Loaded Templates (Skin: $this->skin):
";
foreach ($this->templater->temps as $key => $val)
{
$out .= "$key
";
}
$includes = get_included_files();
$out .= '
' . count($includes) . ' Files In Use:
';
$coef = $includes[0];
for($i = 0; $i < count($includes) - 1; $i++)
{
$l = strlen($coef);
for($j = 0; $j < $l + 1; $j++)
{
$as = substr($includes[$i], 0, $j);
if($as == substr($includes[$i+1], 0, $j)){
$coef = $as;
}
}
}
$coef = strlen($coef);
foreach ($includes as $file)
{
$out .= './' . str_replace('\\', '/', substr($file, $coef)) . '
';
}
$out .= '