Skip to content

Commit

Permalink
Fix rector error and cleanup up filename displays for Debug toolbar d…
Browse files Browse the repository at this point in the history
…atabase tab.
  • Loading branch information
lonnieezell committed Nov 17, 2021
1 parent e33f146 commit e97b95b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 10 additions & 5 deletions system/Debug/Toolbar/Collectors/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,17 @@ public function display(): array
// Find the first line that doesn't include `system` in the backtrace
$line = [];

foreach ($query['trace'] as $traceLine) {
if (strpos($traceLine['file'], 'system/') !== false) {
foreach ($query['trace'] as &$traceLine) {
// Clean up the file paths
$traceLine['file'] = str_ireplace(APPPATH, 'APPPATH/', $traceLine['file']);

This comment has been minimized.

Copy link
@iprixi

iprixi Jan 4, 2022

re #5539

is it possible to check if the file is set before trying to clean up the paths? There are trace lines without file, e.g. function => read

$traceLine['file'] = str_ireplace(SYSTEMPATH, 'SYSTEMPATH/', $traceLine['file']);
$traceLine['file'] = str_ireplace(VENDORPATH, 'VENDORPATH/', $traceLine['file']);
$traceLine['file'] = str_ireplace(ROOTPATH, 'ROOTPATH/', $traceLine['file']);

if (strpos($traceLine['file'], 'APPPATH') === false) {
continue;
}
$line = $traceLine;
break;
$line = empty($line) ? $traceLine : $line;
}

return [
Expand All @@ -153,7 +158,7 @@ public function display(): array
'trace' => $query['trace'],
'trace-file' => str_replace(ROOTPATH, '/', $line['file'] ?? ''),
'trace-line' => $line['line'] ?? '',
'qid' => md5((string) $query['query'] . microtime()),
'qid' => md5($query['query'] . microtime()),
];
}, static::$queries);

Expand Down
6 changes: 3 additions & 3 deletions system/Debug/Toolbar/Views/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@
#toolbarContainer.dark #debug-bar .muted {
color: #DFDFDF; }
#toolbarContainer.dark #debug-bar .muted td {
color: #434343; }
color: #797979; }
#toolbarContainer.dark #debug-bar .muted:hover td {
color: #DFDFDF; }
#toolbarContainer.dark #debug-bar #toolbar-position,
Expand Down Expand Up @@ -589,9 +589,9 @@
-moz-box-shadow: 0 1px 4px #DFDFDF;
-webkit-box-shadow: 0 1px 4px #DFDFDF; }
#toolbarContainer.light #debug-bar .muted {
color: #434343; }
color: #797979; }
#toolbarContainer.light #debug-bar .muted td {
color: #DFDFDF; }
color: #797979; }
#toolbarContainer.light #debug-bar .muted:hover td {
color: #434343; }
#toolbarContainer.light #debug-bar #toolbar-position,
Expand Down

0 comments on commit e97b95b

Please sign in to comment.