[Bb-trac] [bbPress] #909: request for debug_backtrace in
SAVEQUERIES via db-mysql class
bbPress
bb-trac at lists.bbpress.org
Fri Aug 1 03:53:10 GMT 2008
#909: request for debug_backtrace in SAVEQUERIES via db-mysql class
-------------------------+--------------------------------------------------
Reporter: _ck_ | Owner:
Type: enhancement | Status: new
Priority: low | Milestone: 1.0-beta & XML-RPC
Component: Back-end | Version:
Severity: minor | Keywords:
-------------------------+--------------------------------------------------
Could we get the debug_backtrace to track the functions in `db-mysql.php`
like they use on the WordPress side? Not sure if this will happen
automatically via BackPress or not.
in `db-mysql.php` around line 167 would be replaced:
from:
{{{
$this->queries[] = array( $query . ' server:' . $current_connection,
$this->timer_stop() );
}}}
to:
{{{
$this->queries[] = array( $query, $this->timer_stop(), $this->get_caller()
);
}}}
and this function would need to be added:
{{{
function get_caller() {
// requires PHP 4.3+
if ( !is_callable('debug_backtrace') )
return '';
$bt = debug_backtrace();
$caller = '';
foreach ( $bt as $trace ) {
if ( @$trace['class'] == __CLASS__ )
continue;
elseif ( strtolower(@$trace['function']) ==
'call_user_func_array' )
continue;
elseif ( strtolower(@$trace['function']) ==
'apply_filters' )
continue;
elseif ( strtolower(@$trace['function']) ==
'do_action' )
continue;
$caller = $trace['function'];
break;
}
return $caller;
}
}
}}}
--
Ticket URL: <http://trac.bbpress.org/ticket/909>
bbPress <http://bbpress.org/>
Innovative forum development
More information about the Bb-trac
mailing list