Skip to content

Commit

Permalink
Add Redirect Info section to Request Info panel. Fix #84
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbj committed Jul 24, 2023
1 parent 80aeb85 commit ec569bc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
12 changes: 10 additions & 2 deletions TracyDebugger.module.php
Expand Up @@ -27,7 +27,7 @@ public static function getModuleInfo() {
'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__),
'author' => 'Adrian Jones',
'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/',
'version' => '4.25.3',
'version' => '4.25.4',
'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first
'singular' => true,
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
Expand Down Expand Up @@ -91,6 +91,7 @@ public static function getModuleInfo() {
public static $hideInAdmin = array('validator', 'templateResources', 'templatePath');
public static $superUserOnlyPanels = array('console', 'fileEditor', 'adminer', 'terminal', 'adminTools');
public static $pageHtml;
public static $redirectInfo;
public static $processWireInfoSections = array(
'configData' => 'Config Data',
'versionsList' => 'Versions List',
Expand All @@ -114,6 +115,7 @@ public static function getModuleInfo() {
'templateExportCode' => 'Template Export Code',
'fieldsListValues' => 'Field List & Values',
'serverRequest' => 'Server Request',
'redirectInfo' => 'Redirect Info',
'inputGet' => 'Input GET',
'inputPost' => 'Input POST',
'inputCookie' => 'Input COOKIE',
Expand Down Expand Up @@ -255,7 +257,7 @@ static public function getDefaultData() {
"apiExplorerShowDescription" => 1,
"apiExplorerToggleDocComment" => null,
"apiExplorerModuleClasses" => array(),
"requestInfoPanelSections" => array('moduleSettings', 'templateSettings', 'fieldSettings', 'pageInfo', 'pagePermissions', 'languageInfo', 'templateInfo', 'fieldsListValues', 'serverRequest', 'inputGet', 'inputPost', 'inputCookie', 'session', 'editLinks'),
"requestInfoPanelSections" => array('moduleSettings', 'templateSettings', 'fieldSettings', 'pageInfo', 'pagePermissions', 'languageInfo', 'templateInfo', 'fieldsListValues', 'serverRequest', 'redirectInfo', 'inputGet', 'inputPost', 'inputCookie', 'session', 'editLinks'),
"processwireInfoPanelSections" => array('versionsList', 'adminLinks', 'documentationLinks', 'gotoId', 'processWireWebsiteSearch'),
"debugModePanelSections" => array('pagesLoaded', 'modulesLoaded', 'hooks', 'databaseQueries', 'selectorQueries', 'timers', 'user', 'cache', 'autoload'),
"diagnosticsPanelSections" => array('filesystemFolders'),
Expand Down Expand Up @@ -1324,6 +1326,12 @@ function bsZIndex() {
});


// populate redirect info for Request Info panel
$this->wire()->addHookBefore('Session::redirect', function($event) {
static::$redirectInfo = Debug::backtrace()[0];
});


// MAIL INTERCEPTOR
// if mail panel items were cleared, clear them from the session variable
if($this->wire('input')->cookie->tracyClearMailItems || (!in_array('mailInterceptor', static::$showPanels) && $this->wire('session')->tracyMailItems)) {
Expand Down
17 changes: 17 additions & 0 deletions panels/RequestInfoPanel.php
Expand Up @@ -764,6 +764,23 @@ public function getPanel() {
}


// Redirect Info
if(in_array('redirectInfo', $panelSections) && \TracyDebugger::$redirectInfo) {
$redirectInfo = '
<table>';
foreach(\TracyDebugger::$redirectInfo as $k => $v) {
$redirectInfo .= '
<tr>
<td>'.$k.'</td>
<td>'.Dumper::toHtml($v).'</td>
</tr>
';
}
$redirectInfo .= '</table>
';
}


// Input GET, POST, & COOKIE
if(in_array('inputGet', $panelSections) || in_array('inputPost', $panelSections) || in_array('inputCookie', $panelSections)) {
$inputTypes = array();
Expand Down
10 changes: 5 additions & 5 deletions panels/UsersPanel.php
Expand Up @@ -11,12 +11,12 @@ class UsersPanel extends BasePanel {
protected function getUsers() {

$this->numNonSuperusers = 0;
$this->listTracyUsers = null;
$this->listTracyRoles = null;
$this->listTracyUsers = '';
$this->listTracyRoles = '';
$tracyDebuggerRoles = false;
$tracyDebuggerRolesStr = null;
$tracyDebuggerRolesStr = '';

$tooManyUsers = null;
$tooManyUsers = '';

$tracyDebuggerRoles = $this->wire('roles')->find("permissions=tracy-debugger, name!=superuser");
$tracyDebuggerRolesStr = $tracyDebuggerRoles->implode("|","name");
Expand All @@ -37,7 +37,7 @@ protected function getUsers() {
}
if($this->listTracyRoles) {
$this->listTracyRoles = rtrim($this->listTracyRoles, ', ');
}
}

if($this->numNonSuperusers > 0) {
return true;
Expand Down

0 comments on commit ec569bc

Please sign in to comment.