Jump to content
adrian

Tracy Debugger

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

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks and keep bugging us with such updates :)

  • Like 4

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Hello,

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

screenshot-www.juergen-kern.at-2017-10-29-08-56-11.thumb.png.bfa651a7d2260b6bccc94335835c63c4.png

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

Best regards

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      A community member raised a question and I thought a new sanitizer method for the purpose would be useful, hence...
      Sanitizer Transliterate
      Adds a transliterate method to $sanitizer that performs character replacements as defined in the module config. The default character replacements are based on the defaults from InputfieldPageName, but with uppercase characters included too.
      Usage
      Install the Sanitizer Transliterate module.
      Customise the character replacements in the module config as needed.
      Use the sanitizer on strings like so:
      $transliterated_string = $sanitizer->transliterate($string);
       
      https://github.com/Toutouwai/SanitizerTransliterate
      https://modules.processwire.com/modules/sanitizer-transliterate/
       
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version to 2.10, add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "http://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


    • By thomasaull
      I created a little helper module to trigger a CI pipeline when your website has been changed. It's quite simple and works like this: As soon as you save a page the module sets a Boolean via a pages save after hook. Once a day via LazyCron the module checks if the Boolean is set and sends a POST Request to a configurable Webhook URL.
      Some ideas to extend this:
      make request type configurable (GET, POST) make the module trigger at a specified time (probably only possible with a server cronjob) trigger manually Anything else? If there's interest, I might put in some more functionality. Let me know what you're interested in. Until then, maybe it is useful for a couple of people 🙂
      Github Repo: https://github.com/thomasaull/CiTrigger
    • By Robin S
      I created this module a while ago and never got around to publicising it, but it has been outed in the latest PW Weekly so here goes the support thread...
      Unique Image Variations
      Ensures that all ImageSizer options and focus settings affect image variation filenames.

      Background
      When using methods that produce image variations such as Pageimage::size(), ProcessWire includes some of the ImageSizer settings (height, width, cropping location, etc) in the variation filename. This is useful so that if you change these settings in your size() call a new variation is generated and you see this variation on the front-end.
      However, ProcessWire does not include several of the other ImageSizer settings in the variation filename:
      upscaling cropping, when set to false or a blank string interlace sharpening quality hidpi quality focus (whether any saved focus area for an image should affect cropping) focus data (the top/left/zoom data for the focus area) This means that if you change any of these settings, either in $config->imageSizerOptions or in an $options array passed to a method like size(), and you already have variations at the requested size/crop, then ProcessWire will not create new variations and will continue to serve the old variations. In other words you won't see the effect of your changed ImageSizer options on the front-end until you delete the old variations.
      Features
      The Unique Image Variations module ensures that any changes to ImageSizer options and any changes to the focus area made in Page Edit are reflected in the variation filename, so new variations will always be generated and displayed on the front-end.
      Installation
      Install the Unique Image Variations module.
      In the module config, set the ImageSizer options that you want to include in image variation filenames.
      Warnings
      Installing the module (and keeping one or more of the options selected in the module config) will cause all existing image variations to be regenerated the next time they are requested. If you have an existing website with a large number of images you may not want the performance impact of that. The module is perhaps best suited to new sites where image variations have not yet been generated.
      Similarly, if you change the module config settings on an existing site then all image variations will be regenerated the next time they are requested.
      If you think you might want to change an ImageSizer option in the future (I'm thinking here primarily of options such as interlace that are typically set in $config->imageSizerOptions) and would not want that change to cause existing image variations to be regenerated then best to not include that option in the module config after you first install the module.
       
      https://github.com/Toutouwai/UniqueImageVariations
      https://modules.processwire.com/modules/unique-image-variations/
    • By Sebi
      I've created a small module which lets you define a timestamp after which a page should be accessible. In addition you can define a timestamp when the release should end and the page should not be accessable any more.
      ProcessWire-Module: http://modules.processwire.com/modules/page-access-releasetime/
      Github: https://github.com/Sebiworld/PageAccessReleasetime
      Usage
      PageAccessReleasetime can be installed like every other module in ProcessWire. Check the following guide for detailed information: How-To Install or Uninstall Modules
      After that, you will find checkboxes for activating the releasetime-fields at the settings-tab of each page. You don't need to add the fields to your templates manually.
      Check e.g. the checkbox "Activate Releasetime from?" and fill in a date in the future. The page will not be accessable for your users until the given date is reached.
      If you have $config->pagefileSecure = true, the module will protect files of unreleased pages as well.
      How it works
      This module hooks into Page::viewable to prevent users to access unreleased pages:
      public function hookPageViewable($event) { $page = $event->object; $viewable = $event->return; if($viewable){ // If the page would be viewable, additionally check Releasetime and User-Permission $viewable = $this->canUserSee($page); } $event->return = $viewable; } To prevent access to the files of unreleased pages, we hook into Page::isPublic and ProcessPageView::sendFile.
      public function hookPageIsPublic($e) { $page = $e->object; if($e->return && $this->isReleaseTimeSet($page)) { $e->return = false; } } The site/assets/files/ directory of pages, which isPublic() returns false, will get a '-' as prefix. This indicates ProcessWire (with activated $config->pagefileSecure) to check the file's permissions via PHP before delivering it to the client.
      The check wether a not-public file should be accessable happens in ProcessPageView::sendFile. We throw an 404 Exception if the current user must not see the file.
      public function hookProcessPageViewSendFile($e) { $page = $e->arguments[0]; if(!$this->canUserSee($page)) { throw new Wire404Exception('File not found'); } } Additionally we hook into ProcessPageEdit::buildForm to add the PageAccessReleasetime fields to each page and move them to the settings tab.
      Limitations
      In the current version, releasetime-protected pages will appear in wire('pages')->find() queries. If you want to display a list of pages, where pages could be releasetime-protected, you should double-check with $page->viewable() wether the page can be accessed. $page->viewable() returns false, if the page is not released yet.
      If you have an idea how unreleased pages can be filtered out of ProcessWire selector queries, feel free to write an issue, comment or make a pull request!
×
×
  • Create New...