Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Update for SilverStripe 3. #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
7 changes: 5 additions & 2 deletions code/ProfilerLogViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand All @@ -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 );
}

Expand Down
3 changes: 1 addition & 2 deletions dbdecorators/DatabaseQueryLogDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ 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' ] );
unset( $backtrace[ $stackLevel ][ 'args' ] );
}

$backtraceKey = md5( $backtraceKey );
Expand Down