ZFDebug показывает, что запросов на странице 30 - хорошо (всмысле плохо - много, но! знать об этом - это хорошо). Знать бы еще из какой модели был вызван запрос. Поправим это. Решение снова хардкорное :/ не смог придумать как бы его так сделать по-хорошему, пришлось (опять) менять ZF (да-да, знаю за это меня будут мучать вечно в програмистском аду)
, но пока так:
Zend_Db_Profiler_Query::__construct()
/**
* function stack
*
* @var array
*/
public $funcStack = '';
...
if ((APPLICATION_ENV == 'development') && (function_exists('xdebug_get_function_stack'))) {
$funcStack = xdebug_get_function_stack();
foreach ($funcStack as $stack) {
if (false !== strpos($stack['class'], '_Model_')) {
$this->funcStack = $stack;
}
}
}
* This source code was highlighted with Source Code Highlighter.вуаля
object(Zend_Db_Profiler_Query)[274]
protected '_query' => string 'SELECT
COUNT(*) AS count
FROM xxx_messages
WHERE xxx_messages.recipientid = '3'
AND xxx_messages.status = 'unreaded'' (length=198)
public 'funcStack' =>
array
'function' => string 'getUnreadedCountByUID' (length=21)
'class' => string 'XXX_Model_MessagesMapper' (length=27)
'file' => string '/home/maxgu/proj/xxx/web/app/xxx/models/Messages.php' (length=58)
'line' => int 17
'params' =>
array
empty
protected '_queryType' => int 32
protected '_startedMicrotime' => float 1306048553.5072
protected '_endedMicrotime' => float 1306048553.5073
protected '_boundParams' =>
array
empty
* This source code was highlighted with Source Code Highlighter.теперь делаем красиво в ZFDebug_Controller_Plugin_Debug_Plugin_Database::getPanel()
...
foreach ($profiles as $profile) {
$html .= '<li><strong>['.round($profile->getElapsedSecs()*1000, 2).' ms]</strong> '
.htmlspecialchars($profile->getQuery());
if (!empty($profile->funcStack)) {
$html .= "<br/><strong>stack</strong>: {$profile->funcStack['class']}::{$profile->funcStack['function']}() ({$profile->funcStack['file']}:{$profile->funcStack['line']})";
}
$html .= '</li>';
}
...
* This source code was highlighted with Source Code Highlighter.
Комментариев нет:
Отправить комментарий