From 2c398449648a5519c6547f293380649b3f2a4aa1 Mon Sep 17 00:00:00 2001 From: jakr Date: Wed, 11 Jul 2012 18:25:14 +0200 Subject: [PATCH 1/3] Update for SilverStripe 3. ProfilerLogViewerController: Changed method signature of Link() and replaced DataObjectSet with ArrayList and ArrayData in init(). DatabaseQueryLogDecorator: logBacktrace now keeps the argument list (args), since SS_Backtrace requires it. --- code/ProfilerLogViewerController.php | 7 +++++-- dbdecorators/DatabaseQueryLogDecorator.php | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/code/ProfilerLogViewerController.php b/code/ProfilerLogViewerController.php index 59e27ce..75d5750 100755 --- a/code/ProfilerLogViewerController.php +++ b/code/ProfilerLogViewerController.php @@ -23,7 +23,10 @@ public function init() { $this->rawdata = $logData; foreach( $logData as $key => $data ) { if( is_array( $data ) ) { - $logData[ $key ] = new DataObjectSet( $logData[ $key ] ); + $logData[ $key ] = new ArrayList(); + foreach ($data as $i => $item) { + $logData[ $key ][$i] = new ArrayData($item); + } } } @@ -49,7 +52,7 @@ public function index( SS_HTTPRequest $request ) { * * @return string */ - public function Link() { + public function Link($action=null) { return Director::absoluteURL( 'ProfilerLogViewerController', true ); } diff --git a/dbdecorators/DatabaseQueryLogDecorator.php b/dbdecorators/DatabaseQueryLogDecorator.php index c8776a7..dd37787 100755 --- a/dbdecorators/DatabaseQueryLogDecorator.php +++ b/dbdecorators/DatabaseQueryLogDecorator.php @@ -92,7 +92,6 @@ protected function logBacktrace( $key ) { $backtraceKey .= $backtrace[ $stackLevel ][ 'class' ] . '_' . $backtrace[ $stackLevel ][ 'function' ] . '____'; } unset( $backtrace[ $stackLevel ][ 'object' ] ); - unset( $backtrace[ $stackLevel ][ 'args' ] ); } $backtraceKey = md5( $backtraceKey ); From b3052090aa40e97b5ecb9f5db4b9d66936ab0972 Mon Sep 17 00:00:00 2001 From: jakr Date: Thu, 12 Jul 2012 13:04:50 +0200 Subject: [PATCH 2/3] Fix: logBacktrace was not aware of closures. --- dbdecorators/DatabaseQueryLogDecorator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbdecorators/DatabaseQueryLogDecorator.php b/dbdecorators/DatabaseQueryLogDecorator.php index dd37787..35fb095 100755 --- a/dbdecorators/DatabaseQueryLogDecorator.php +++ b/dbdecorators/DatabaseQueryLogDecorator.php @@ -88,7 +88,7 @@ protected function logBacktrace( $key ) { foreach( $backtrace as $stackLevel => $val ) { if( isset( $backtrace[ $stackLevel ][ 'file' ] ) ) { $backtraceKey .= $backtrace[ $stackLevel ][ 'file' ] . '_' . $backtrace[ $stackLevel ][ 'line' ] . '____'; - } else { + } else if( isset( $backtrace[ $stackLevel ][ 'class' ] ) ) { //closures have no class! $backtraceKey .= $backtrace[ $stackLevel ][ 'class' ] . '_' . $backtrace[ $stackLevel ][ 'function' ] . '____'; } unset( $backtrace[ $stackLevel ][ 'object' ] ); From 7f65e969dd16b2e57cd6c17837a2c6724fee9dbb Mon Sep 17 00:00:00 2001 From: jakr Date: Wed, 1 Aug 2012 19:39:52 +0200 Subject: [PATCH 3/3] Added note about breaking tests to README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46dcba9..4c0b980 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,12 @@ Extract / clone it in the root folder of your SilverStripe repository. Change your database class in the _ss_environment.php to -`define( 'SS_DATABASE_CLASS', 'ProfilerMySQLDatabase' );` + if(strstr($_SERVER['REQUEST_URI'], '/dev/tests/') === false) { + define( 'SS_DATABASE_CLASS', 'ProfilerMySQLDatabase' ); + } + +This makes sure that dbprofiler is disabled for tests, since they do not + run correctly if it is enabled. Flush your site by appending the ?flush=1 to the url or use sake.