Skip to content

Commit f7cc9aa

Browse files
committed
Add debugbar code back.
1 parent 6dc3278 commit f7cc9aa

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

system/core/Loader.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,20 @@ class_exists('CI_DB', FALSE) OR $this->database();
498498
*/
499499
public function view($view, $vars = array(), $return = FALSE)
500500
{
501-
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return));
501+
$measure = "View - $view";
502+
$CI =& get_instance();
503+
504+
if ($CI->debugbar) {
505+
$CI->debugbar["time"]->startMeasure($measure);
506+
}
507+
508+
$result = $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return));
509+
510+
if ($CI->debugbar) {
511+
$CI->debugbar["time"]->stopMeasure($measure);
512+
}
513+
514+
return $result;
502515
}
503516

504517
// --------------------------------------------------------------------

system/database/drivers/pdo/pdo_driver.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
* @since Version 2.1.0
3737
* @filesource
3838
*/
39+
40+
use DebugBar\DataCollector\PDO\TraceablePDO;
41+
3942
defined('BASEPATH') OR exit('No direct script access allowed');
4043

4144
/**
@@ -129,6 +132,8 @@ public function __construct($params)
129132
*/
130133
public function db_connect($persistent = FALSE)
131134
{
135+
global $debugbar;
136+
132137
if ($persistent === TRUE)
133138
{
134139
$this->options[PDO::ATTR_PERSISTENT] = TRUE;
@@ -144,7 +149,13 @@ public function db_connect($persistent = FALSE)
144149

145150
try
146151
{
147-
return new PDO($this->dsn, $this->username, $this->password, $this->options);
152+
if ($debugbar) {
153+
$pdo = new TraceablePDO(new PDO($this->dsn, $this->username, $this->password, $this->options));
154+
$debugbar->addCollector(new DebugBar\DataCollector\PDO\PDOCollector($pdo));
155+
return $pdo;
156+
} else {
157+
return new PDO($this->dsn, $this->username, $this->password, $this->options);
158+
}
148159
}
149160
catch (PDOException $e)
150161
{

0 commit comments

Comments
 (0)