Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stg plg system debug log category mode #5146

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 35 additions & 23 deletions plugins/system/debug/debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,17 @@ protected function displayQueries()
// Compute the query time.
$queryTime = ($timings[$id * 2 + 1] - $timings[$id * 2]) * 1000;

// Timing. Formats the output for the query time with EXPLAIN query results as tooltip.
$htmlTiming = '<div style="margin: 0px 0 5px;"><span class="dbg-query-time">'
. JText::sprintf('PLG_DEBUG_QUERY_TIME', sprintf('<span class="label ' . $info[$id]->class . '">%.2f&nbsp;ms</span>', $timing[$id]['0']));
// Timing
// Formats the output for the query time with EXPLAIN query results as tooltip:
$htmlTiming = '<div style="margin: 0px 0 5px;"><span class="dbg-query-time">';
$htmlTiming .= JText::sprintf(
'PLG_DEBUG_QUERY_TIME',
sprintf(
'<span class="label %s">%.2f&nbsp;ms</span>',
$info[$id]->class,
$timing[$id]['0']
)
);

if ($timing[$id]['1'])
{
Expand Down Expand Up @@ -960,8 +968,7 @@ protected function displayQueries()
}

$htmlResultsReturned = '<span class="label ' . $labelClass . '">' . (int) $resultsReturned . '</span>';
$htmlTiming .= ' ' . '<span class="dbg-query-rowsnumber">'
. JText::sprintf('PLG_DEBUG_ROWS_RETURNED_BY_QUERY', $htmlResultsReturned) . '</span>';
$htmlTiming .= ' <span class="dbg-query-rowsnumber">' . JText::sprintf('PLG_DEBUG_ROWS_RETURNED_BY_QUERY', $htmlResultsReturned) . '</span>';
}
}

Expand Down Expand Up @@ -1001,8 +1008,8 @@ protected function displayQueries()

if (!$this->linkFormat)
{
$htmlCallStack .= '<div>[<a href="http://xdebug.org/docs/all_settings#file_link_format" target="_blank">'
. JText::_('PLG_DEBUG_LINK_FORMAT') . '</a>]</div>';
$htmlCallStack .= '<div>[<a href="http://xdebug.org/docs/all_settings#file_link_format" target="_blank">';
$htmlCallStack .= JText::_('PLG_DEBUG_LINK_FORMAT') . '</a>]</div>';
}
}

Expand Down Expand Up @@ -1162,11 +1169,11 @@ protected function displayQueries()
}

/**
* Render bars.
* Render the bars.
*
* @param array &$bars Array of bar data.
* @param string $class Optional class for items.
* @param integer $id Id of the bar to highlight.
* @param array &$bars Array of bar data
* @param string $class Optional class for items
* @param integer $id Id if the bar to highlight
*
* @return string
*
Expand Down Expand Up @@ -1198,18 +1205,18 @@ protected function renderBars(&$bars, $class = '', $id = null)
$tip = JHtml::tooltipText($bar->tip, '', 0);
}

$html[] = '<a class="bar dbg-bar ' . $barClass . '" title="' . $tip . '" style="width: '
. $bar->width . '%;" href="#dbg-' . $class . '-' . ($i + 1) . '"></a>';
$html[] = '<a class="bar dbg-bar ' . $barClass . '" title="' . $tip . '" style="width: ' .
$bar->width . '%;" href="#dbg-' . $class . '-' . ($i + 1) . '"></a>';
}

return '<div class="progress dbg-bars dbg-bars-' . $class . '">' . implode('', $html) . '</div>';
}

/**
* Render array as HTML table.
* Render an HTML table based on a multi-dimensional array.
*
* @param array $table Array to be rendered.
* @param boolean &$hasWarnings Changes value to true if warnings are displayed, otherwise untouched.
* @param array $table An array of tabular data.
* @param boolean &$hasWarnings Changes value to true if warnings are displayed, otherwise untouched
*
* @return string
*
Expand Down Expand Up @@ -1284,9 +1291,10 @@ protected function tableToHtml($table, &$hasWarnings)
{
if ($td === 'NULL')
{
// Displays query parts which don't use a key with warning.
$html[] = '<td><strong>' . '<span class="dbg-warning hasTooltip" title="' . JHtml::tooltipText('PLG_DEBUG_WARNING_NO_INDEX_DESC') . '">'
. JText::_('PLG_DEBUG_WARNING_NO_INDEX') . '</span>' . '</strong>';
// Displays query parts which don't use a key with warning:
$html[] = '<td><strong>' . '<span class="dbg-warning hasTooltip" title="' .
JHtml::tooltipText('PLG_DEBUG_WARNING_NO_INDEX_DESC') . '">' .
JText::_('PLG_DEBUG_WARNING_NO_INDEX') . '</span>' . '</strong>';
$hasWarnings = true;
}
else
Expand All @@ -1301,10 +1309,14 @@ protected function tableToHtml($table, &$hasWarnings)
// Replace spaces with &nbsp; (non-breaking spaces) for less tall tables displayed.
$htmlTd = preg_replace('/([^;]) /', '\1&nbsp;', $htmlTd);

// Displays warnings for "Using filesort".
$htmlTdWithWarnings = str_replace('Using&nbsp;filesort', '<span class="dbg-warning hasTooltip" title="'
. JHtml::tooltipText('PLG_DEBUG_WARNING_USING_FILESORT_DESC') . '">' . JText::_('PLG_DEBUG_WARNING_USING_FILESORT') . '</span>', $htmlTd
);
// Displays warnings for "Using filesort":
$htmlTdWithWarnings = str_replace(
'Using&nbsp;filesort',
'<span class="dbg-warning hasTooltip" title="' .
JHtml::tooltipText('PLG_DEBUG_WARNING_USING_FILESORT_DESC') . '">' .
JText::_('PLG_DEBUG_WARNING_USING_FILESORT') . '</span>',
$htmlTd
);

if ($htmlTdWithWarnings !== $htmlTd)
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/debug/debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
description="PLG_DEBUG_FIELD_LOG_CATEGORIES_DESC"
/>

<field name="log_category_mode" type="hidden" default="0"
<field name="log_category_mode" type="radio" default="0" class="btn-group btn-group-yesno"
label="PLG_DEBUG_FIELD_LOG_CATEGORY_MODE_LABEL"
description="PLG_DEBUG_FIELD_LOG_CATEGORY_MODE_DESC"
>
Expand Down