In the \libraries\joomla\database\database\mysql.php file change the query function to:
Code: Select all
function query()
{
if (!is_resource($this->_resource)) {
return false;
}
if ($this->_limit > 0 || $this->_offset > 0) {
$this->_sql .= ' LIMIT '.$this->_offset.', '.$this->_limit;
}
if ($this->_debug) {
$this->_ticker++;
//$this->_log[] = $this->_sql;
$t = microtime();
}
$this->_errorNum = 0;
$this->_errorMsg = '';
$this->_cursor = mysql_query( $this->_sql, $this->_resource );
if (!$this->_cursor)
{
$this->_errorNum = mysql_errno( $this->_resource );
$this->_errorMsg = mysql_error( $this->_resource )." SQL=$this->_sql";
if ($this->_debug) {
JError::raiseError(500, 'JDatabaseMySQL::query: '.$this->_errorNum.' - '.$this->_errorMsg );
}
return false;
}
if ($this->_debug) {
$this->_log[] = $this->_sql. '--Time: '.(microtime() - $t);
}
return $this->_cursor;
}
Code: Select all
$newlineKeywords = '/<span style="color: #993333; font-weight: bold;">'
.'(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND|OR)'
.'<\\/span>/i'
;
Then in the same function add a few regexps to the if ($log = $db->getLog()) loop:
Code: Select all
if ($log = $db->getLog())
{
echo '<ol>';
foreach ($log as $k=>$sql)
{
$geshi->set_source($sql);
$text = $geshi->parse_code();
$text = preg_replace($newlineKeywords, '<br> \\0', $text);
$text = preg_replace('#(ON|AND|OR)<#', ' \\0', $text);
$text = preg_replace('# #', '', $text);
$text = preg_replace('#<br />#', '<br>', $text);
$text = preg_replace('#( )+?<br>#', '<br>', $text);
$text = preg_replace('#<br>(\W+)?<br>#s', '<br>', $text);
$text = str_replace('--Time:', '<br>Time:', $text);
echo '<li>'.$text.'<br></li>';
}
echo '</ol>';
}
Code: Select all
SELECT folder AS type, element AS name, params
FROM jos_plugins
WHERE published >= 1
AND access <= 2
ORDER BY ordering
Time: 0.001047