Jump to content

Tracy Debugger


adrian

Recommended Posts

Just an FYI - in the Console panel you can now do mixed HTML/PHP without needing to add a php closing tag first.

<p>Welcome to the <?=$page->name?> page!</p>

 

File-based snippets (Snippet Runner) can be plain html, plain php, or mixed html/php, but they must have an opening php tag as per normal PHP requirements.

The Console panel does not require an opening PHP tag (although having one will still work). You can use mixed html/php as per the example above, but for a pure HTML file you will need an initial ?> before the HTML to make it work, eg:

?>
<p>Welcome to this page</p>

Plain html in the Console seems like a pretty uncommon use case, so hopefully this gives us the most flexibility without too much weirdness.

  • Like 1
Link to comment
Share on other sites

Hi,

I don't understand why request info panel is not displaying correctly.

If I remove server request and Input cookie, there is nothing in the panel, so I guess it kind of working correctly.

Thanks

PW 3.0.48 Tracy 4.6.12

 

Request Info - Mozilla Firefox_201.png

Screenshot-2017-10-13 Modules • ProcessWire • localhost.png

  • Like 1
Link to comment
Share on other sites

Hi @mel47 - yeah, that's confusing to me too.

I know what's stopping them from being displayed, but still not sure exactly why - I am thinking it might be a Windows path issue at this stage.

Can you please post a screenshot of the Server Request section expanded. If it's easier, just the bottom half of it will be fine, from SERVER_NAME onwards. I am sure it will be a simple fix, but I need to know what some of those values are returning for you.

Thanks!

Link to comment
Share on other sites

New Search ProcessWire website feature in the ProcessWire Info Panel. 

For updates to old Tracy installs, you will need to manually enable this feature in the module settings. It is on by default in new installs.

Any term you type in the box will take you to a Google site search for the PW website, eg a search for Tracy will take you to the results for a 

site:processwire.com/ tracy

Hopefully you guys find this useful!

59e16a23cfccf_ScreenShot2017-10-13at6_35_19PM.png.6536daf70b738cf98cd95e14b4a68971.png

  • Like 5
Link to comment
Share on other sites

20 minutes ago, adrian said:

New Search ProcessWire website feature in the ProcessWire Info Panel. 

Nice. How about some radios for more focused searches?

API reference - site:processwire.com/api/
Forums - site:processwire.com/talk/
Blog - site:processwire.com/blog/

I have these as keyword searches in my browser and they get a lot of use. :)
(TBH, it's so easy to Ctrl+L focus the browser address bar and do a keyword search that I'm not likely to give the Tracy feature much use, but maybe some will prefer the Tracy option).

  • Like 3
Link to comment
Share on other sites

11 hours ago, Robin S said:
12 hours ago, adrian said:

 

Nice. How about some radios for more focused searches?

API reference - site:processwire.com/api/
Forums - site:processwire.com/talk/
Blog - site:processwire.com/blog/

 

Yeah, I was thinking about doing that - just implemented:

59e218eb8fcca_ScreenShot2017-10-14at7_01_57AM.png.58cefbd4ddbcd35ab4701e6cd71fe2ff.png

  • Like 3
  • Thanks 2
Link to comment
Share on other sites

On 13/10/2017 at 8:44 AM, adrian said:

Hi @mel47 - yeah, that's confusing to me too.

I know what's stopping them from being displayed, but still not sure exactly why - I am thinking it might be a Windows path issue at this stage.

Can you please post a screenshot of the Server Request section expanded. If it's easier, just the bottom half of it will be fine, from SERVER_NAME onwards. I am sure it will be a simple fix, but I need to know what some of those values are returning for you.

Thanks!

Thanks

 

Request Info - Mozilla Firefox_203.png

  • Like 1
Link to comment
Share on other sites

10 minutes ago, adrian said:

Thanks @mel47 - that explains it - it's because you are running your site in a subdirectory: /24h/

Could you please confirm that: 


d($urls->root);

in the Tracy Console panel returns: /24h/

Once I know that I'll be able to fix this.

Yes exactly :

"/24h/" (5)
  • Like 1
Link to comment
Share on other sites

1 minute ago, mel47 said:

Thanks for the efficiency! Come back of my preferred panel! ;-)

Good to hear it's working again. I hope that splitting up of that info across the PW Info panel and this new Request Info panel is proving ok for you. As I mentioned above, I wanted to make the relevant info also appear in the AJAX bar, but didn't want doubling up of links to the PW admin and other things that don't change, hence the need for this change.

  • Like 1
Link to comment
Share on other sites

Just a quick update to let you all know that:

1) With lots of help from @gmclelland we have been ticking off a lot of PHP 7.2 errors. Not sure that we have discovered them all yet though, so please let me know if you come across any.

2) I just forced the Validator panel to use the HTML5 version all the time. I was finding the other version wasn't working for some sites. Hopefully this won't cause any problems, but please let me know if you find anything amiss.

  • Like 4
Link to comment
Share on other sites

Nice little improvement to the ProcessWire Info panel. I have reduced the admin links section down to some basics: 

  • Admin
  • Login / Logout
  • Clear Session & Cookies
  • Tracy Debugger Settings.

The removed links can now be added as you wish via the "Custom Links" section. This is configurable in the module settings and lets you link to any page in the Page Tree. The two screenshots show the same custom links (with and without labels). 

You'll notice that I have added links to a few Process modules (Upgrades, Changelog, and Cache Admin), along with the links that used to be available by default, and then another link to "Add Page" and also to a plain page (My Special Page). Personally I am just going to remove many of these for my own setup so it's just down to those I use a lot. For example I will definitely delete the "Fields", "Templates", and "Roles" links because I rarely want to go to those parent pages anyway - I always want to go via the admin submenus to go to a specific template or field, etc.

Anyway, hopefully you'll all find this a useful way to add shortcuts to regular admin tools from the frontend of your sites.

59ed311d88771_ScreenShot2017-10-22at11_01_08AM.png.662b0baf07b4cddda508e321379d73ea.png59ed311c02225_ScreenShot2017-10-22at11_02_20AM.thumb.png.4762b07c2bf6b23fe01dd1eb9cc4b74a.png

On a minor technical note, the module settings for these custom links actually converts the page IDs to page paths so that you can use the Module Settings Import Export module to setup Tracy on other sites without having to redefine these links (because page IDs for non admin pages will be different).

  • Like 6
Link to comment
Share on other sites

If you're think you're going crazy (I did :)) and wondering why you can't uninstall modules on your site, please update Tracy! - the new Request Info panel was the cause.

I also just fixed an issue with the ProcessWire Version Switcher panel. Not sure when it stopped working as expected (I think maybe a PW core change affected it?), but it wasn't doing a final reload after the version was changed which made it look like nothing had happened. This is now fixed and once again makes it possible to change core versions with one click.

  • Like 1
Link to comment
Share on other sites

Major revamp to Dumps / Dumps Recorder panels

This has bugged me for a while - the Tracy core dumps panel is:

  • ugly and with a forced label whether you want labels for it or not
  • doesn't show a count of dumps next to the icon
  • doesn't show dumps from consecutive ajax calls - each call overwrites the previous dump

That is why I built the original Dumps Recorder panel, but it also had a problem:

  • the redirect and ajax Dumps Recorder panels contained all previous dumps (those from the main page request, etc) which made it hard to see what was from what

So now I have overridden the core Dumps panel with a new version that has:

  • an optional label
  • a count of dumps
  • adds consecutive ajax calls so you don't miss any. 

I have rebuilt the Dumps Recorder panel as well. You probably won't want this most of the time, so it is no longer enabled by default on new Tracy installs, so if you are upgrading, I recommend disabling the Dumps Recorder panel by default and just enabling via the Panel Selector as needed. It no longer has a "Preserve Dumps" option, because that is now it's only purpose, so when it is enabled, it will preserve all dumps across all page / ajax requests and reloads. You can click "Clear Dumps" whenever you want, and of course disabling it will also clear the recorded dumps.

I think this is a major improvement - it keeps things simple when that's all you need, but enables recording when you want to keep track of changes over multiple requests or you simply find that your bd() calls are somehow being lost / not shown - sometimes I see this when debugging modules - the dumps will be stored, but not shown - the dumps recorder will record these and show on the next page reload.

Hope all that makes sense - please try it out and let me know if you find anything that you think can be improved.

One other thing - I have moved the $_SESSION section from the Debug mode panel to the Request Info panel - I think that's a more appropriate location - inline with having the INPUT (post, get, and cookies) in there. On Tracy upgrades, you'll need to enable SESSION in the config settings for the Request Info panel.

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

Hi @adrian,

What do you think about the idea of adding a filter search to the Captain Hook panel? Much of the time when I use this panel I know the name of the class and method I want to hook and I'm just wanting to check what the arguments are (and it's a handy way to jump to the method in my editor).

Not sure how tricky that would be to implement. Even if it just worked on the top level (the file names) it would be cool.

Link to comment
Share on other sites

7 hours ago, Robin S said:

Hi @adrian,

What do you think about the idea of adding a filter search to the Captain Hook panel? Much of the time when I use this panel I know the name of the class and method I want to hook and I'm just wanting to check what the arguments are (and it's a handy way to jump to the method in my editor).

Not sure how tricky that would be to implement. Even if it just worked on the top level (the file names) it would be cool.

Hey Robin - I have thought about it but I have always found that clicking Toggle All and then CTRL/CMD+F to use the browser's "Find" functionality works just fine. I agree that it would be a nice addition though, so I will have a think about it.

 

4 hours ago, Juergen said:

Hello,

today I have activated the Captain Hook Panel in Tracy for the first time and I always get this message:

What should I do to prevent this? Where can I define the variable "paths"?

Best regards

Hey Juergen - I am wondering if maybe you're running PHP 5.3? I think it might be coming from the fact that I directly set $paths[] rather than previously defining $paths = array()

Could you help me out and try adding: 

$paths = array();

on line 32, before the start of the foreach on 33

Please let me know if that works.

Link to comment
Share on other sites

1 minute ago, Juergen said:

I am running  PHP 7.0.22 :) so "[]" are not the problem.

Well in that case can I please ask if you could check where things are failing. Start with checking if the "if" statement on line 35 ever validates. The maybe the value of $iter before the foreach. Then go back and check $root which is defined in the GenerateHTML.php file.

Thanks for helping with this.

Link to comment
Share on other sites

Ok, i figured it out. Adding

$paths = array();

before the foreach start solves the problem. So it seems that if $path is not defined as an array before the foreach, it doesnt work. So the complete code is like this:

        $paths = array();//this solves the problem
        foreach ($iter as $path => $dir) {
            // '/.' check is for site module backups - SKIP_DOTS above is not excluding these
            if (!$dir->isDir() && strpos($path, '/.') === false && preg_match($fileNamePattern, $path) && !in_array(basename($path), $excludeFilenames) ) {
                $paths[] = $path;
            }
        }

        return $paths;

Best regards

 

  • Like 1
Link to comment
Share on other sites

1 minute ago, Juergen said:

Ok, i figured it out. Adding


$paths = array();

before the foreach start solves the problem.

Thanks - that is what I thought. Weird though that it's not causing problems for anyone else :)

I'll push an update in a minute.

  • Like 1
Link to comment
Share on other sites

  • adrian pinned and locked this topic
  • adrian unpinned and pinned this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...