Jump to content
adrian

Tracy Debugger

Recommended Posts

4 minutes ago, gmclelland said:

The scanning of files for ToDo items to prevent any file scanning altogether.

I remember Drupal having a similar problem here https://www.drupal.org/node/2329453

But that's what the "Ignore Directories" option is for. Are you suggesting that I should hard code in  those bower, sass, node_modules etc, so you don't need to manually add them?

Share this post


Link to post
Share on other sites

No, I'm not suggesting you hard code those values.  I just thought those "node_modules, .sass-cache, etc.." could be added to the other defaults (git svn etc..).

I was also suggesting to include a new checkbox [Scan files for To Do items].  Checking this would show all the other fields(like defaults to exclude, scan modules? etc..).  This way the whole functionality can be turned off completely if it isn't going to be used.

No biggie though, as of right now I'm not experiencing any performance problems.

Share this post


Link to post
Share on other sites
2 minutes ago, gmclelland said:

I just thought those "node_modules, .sass-cache, etc.." could be added to the other defaults (git svn etc..).

Ok, that sounds reasonable :)

2 minutes ago, gmclelland said:

I was also suggesting to include a new checkbox [Scan files for To Do items].  Checking this would show all the other fields(like defaults to exclude, scan modules? etc..).  This way the whole functionality can be turned off completely if it isn't going to be used.

Scanning will only happen if you have the ToDo panel enabled - disabling the panel would do the same as what you are suggesting, unless I am not fully understanding ?

Share this post


Link to post
Share on other sites
30 minutes ago, adrian said:

Scanning will only happen if you have the ToDo panel enabled - disabling the panel would do the same as what you are suggesting, unless I am not fully understanding ?

Great.  I didn't know that.  I'll just turn off that panel.  Thanks Adrian

  • Like 1

Share this post


Link to post
Share on other sites

@gmclelland - latest version includes node_modules and sass-cache as default directories to exclude.

On an unrelated note, I have also added a new "Selector Queries" section to the PW Debug panel. This shows you all the selector calls made during the current page load.

58c7393ae0543_ScreenShot2017-03-13at5_26_18PM.thumb.png.c1f30ec94a67566155c5d21a4340249e.png

 

This post also includes a Console Panel snippet idea. If you need to look up a page, template or field ID, this snippet will return the name, title, label, edit and view links, etc. Just enter the ID and the type and run. I have saved it as "Info from ID", but you can choose whatever name you want. Code included in a spoiler below. 

58c73a072d2c5_ScreenShot2017-03-13at5_31_41PM.thumb.png.d4c21bf31601206cea879cb8a2496824.png

Spoiler

$id = 1; // ID of page, template or field
$type = 'page'; // 'page', 'template', or 'field'

// no need to edit below
$typeVar = $type.'s';
$obj = $$typeVar->get($id);
if($obj->id) {
    if($type == 'page') {
        echo '<p><strong>' . $obj->title . '</strong></p><p>' .
        ($obj->editable() ? '<a href="'.$obj->editUrl().'">Edit</a>' : 'Page not editable.') . ' | ' . 
        ($obj->viewable() ? '<a href="'.$obj->url.'">View</a>' : 'Page not viewable') . '</p><p>' .
        'Path: ' . $obj->path . '<br />' .
        'URL: ' . $obj->httpUrl . '<br />' .
        'Template: ' . $obj->template->name .
        '</p>';
    }
    if($type == 'template') {
        echo '<p><strong>' . ($obj->label ? $obj->label.' ('.$obj->name.')' : $obj->name) . '</strong></p><p>' .
        '<a href="'.$config->urls->admin.'setup/template/edit?id='.$id.'">Edit</a>' .
        '</p>';     
    }
    if($type == 'field') {
        echo '<p><strong>' . ($obj->label ? $obj->label.' ('.$obj->name.')' : $obj->name) . '</strong></p><p>' .
        '<a href="'.$config->urls->admin.'setup/field/edit?id='.$id.'">Edit</a>' .
        '</p>';     
    }    
}
else {
    echo '<p>' . ucfirst($type) . ' does not exist.</p>';
}

 

 

  • Like 5

Share this post


Link to post
Share on other sites

Hey @adrian and others, I need your help. How can I use the Tracy Debug Bar on an external site, which includes ProcessWire´s core?

Tracy is already defined when I include the ProcessWire core (where Tracy Debugger is installed), so I don´t include the standalone version of Tracy anymore.
But the debug bar does not show up nor the needed HTML code gets added to the page.

Here is what I do. How can I show this beautiful debug thingy?

This does not work:
require(__DIR__ . '/../myprocesswire-installation/index.php');
TD::barDump('Show a dump'); // This does nothing

// This works if I don´t include ProcessWire, but I need it
//require 'lib/tracy/src/tracy.php';
//    use Tracy\Debugger;
//
//    Debugger::enable();
//    Debugger::$logSeverity = E_NOTICE | E_WARNING;
//    Debugger::barDump('test');

 

Share this post


Link to post
Share on other sites

@jmartsch - I think the issue you are having is likely permission access to the debug bar. When I use it in bootstrapped mode, I can use bd() calls as normal. Just make sure you are logged into the backend before loading the bootstrapped page.

Does that work for you?

PS - I don't have to do any manual loading of the Tracy core when I do this.

Share this post


Link to post
Share on other sites

You were right, it was a permission problem. Logged in as admin and the bar showed up. Sorry for bothering you. Could have thought of this myself.

  • Like 1

Share this post


Link to post
Share on other sites

Glad that worked for you @jmartsch

On another note, the new Selector Queries section in the DebugMode panel now includes a "Time" column so you can see how long each of your selectors is taking. Note that #7 is an intentionally relatively slow query to make a point for this screenshot:

58cad015e6879_ScreenShot2017-03-16at10_48_18AM.png.cd08a59d7d8da7c04c6c1387282b4439.png

Keep in mind that caching may get involved here once you reload a page. Clearing the session (eg logging out and in again) will show you the speed on first load for a user.

Also, just added a "Logout" icon/button to the PW Info panel - nice shortcut if you want to logout from the front-end of your site.

58cad309933ec_ScreenShot2017-03-16at11_01_31AM.png.cb24378b42ade23c36e493a4c91afc8a.png

  • Like 2

Share this post


Link to post
Share on other sites

For anyone who tries out the new sidebar features in the UiKit admin theme, I just wanted to mention that I already have a partial fix (not committed yet) for the problem of the debug bar appearing in each sidebar, along with the main content area. Each sidebar (and main content area) is an iframe, which is why the debug bar gets loaded in each one. The fix I have works for the initial page load, but falls down when you try to edit a page. I have suggested a change to the core/uikit theme to Ryan (in a PM) that will allow me to fix this as well, but I need him to implement first.

I'll update Tracy as soon as there is a fully working solution.

Cheers,
Adrian

  • Like 1

Share this post


Link to post
Share on other sites

Ok, I went with a different fix for the UiKit admin theme sidebars that works with the current version of PW and the UiKit theme.

If sidebars are enabled, the Tracy debug bar is attached to the main iframe. 

Please let me know if you notice any issues.

Share this post


Link to post
Share on other sites

Hi @adrian,

I didn't read the whole 37 sites, so sorry if this comes up again, but I have a really weird problem: The debugger bar is not shown in one situation. Most of the time it will not show if I do something like this:

  1. fill out formular and send (bar is shown before send)
  2. check form (same page/template), if ok: forward to another page.
  3. at the other page: the bar is not loaded/shown, even after reload and browser cache disabled.
  4. waiting for around one or two minutes, then reload the same page: bar is shown.

Between point 3 and 4 I can visit other pages and the bar is still not shown. At point 4 the missed dumps and send emails are shown. This is making problems at some pages, that should not be reloaded again.

After some minutes the bar is shown again. before there is no visibility, and the div container with the id "tracy-debug" is not loaded/created. The show button is loaded, but hidden and if unhidden then it has no function at all.

Is this known?

Share this post


Link to post
Share on other sites

Hi @godmok - thanks for the report. Unfortunately I am having a trouble understanding exactly what the steps are to reproduce this. Is there any chance you could share a screencast of the problem in action? Also, might I have access to the server (if it's online) so I can test - although I think the screencast first still might be important.

I don't think I have ever come across anything like this. Anyone else ?

Hopefully we can get to the bottom of it though and get it fixed.

 

  • Like 1

Share this post


Link to post
Share on other sites

Just added a new "Clear Session & Cookies" button in the ProcessWire Info panel:

58d86d8704d75_ScreenShot2017-03-26at6_40_10PM.png.842698bfd19eddc5601a50496ec018df.png

It's the new reset/reload looking icon.

This will log you out and back in again, clear all cookies for the domain, and return you to the same URL you were on (along with the full query string).

I have been finding this very handy with module development when it is manipulating parts of the admin that are cached (like menus etc), but it can also be handy for example when you change an Images field's "Default image grid mode" setting because you need to clear cookies to see these changes. I am sure you'll find other uses as well.

  • Like 4

Share this post


Link to post
Share on other sites
On 6/19/2016 at 8:04 AM, netcarver said:

@adrian, Git branch integration next? :rolleyes:

Well, it's been a long time coming, and not sure if it's exactly what you had in mind, but I just added a new "Git Info" panel that displays Git branch, latest commit message, etc for your site (assuming you have it under Git version control). This is just the first version. My goal is to add color coding of the icon (like many other panels) to get your attention. I am looking for feedback on this though. I could either make it possible to configure different colors for different branches, or else I could try to match the branch name against the subdomain / extension, eg. dev.mysite.com, staging.mysite.com or mysite.dev, mysite.staging, etc and color green if they match and red as a warning if they don't.

Anyone have any thoughts on the best approach?

58dc0851b7439_ScreenShot2017-03-29at12_11_10PM.png.56daffa26d97781985903d582bc77898.png

 

On another note, I just had to do quite a bit of work fixing the "Versions List" feature on the ProcessWire Info panel - two recent Tracy core updates broke this functionality and I just noticed. Also, it looks like Github changed the way they handle line breaks inside <details> tags, so also had to tweak that, but I think everything is working again now!

  • Like 3

Share this post


Link to post
Share on other sites

Good day @adrian!

I try to turn on User Switcher panel, but somehow it does not work for me. Could you please explain a bit how to get it to work, under what conditions it appears... how the icon on the panel should look like)))

Share this post


Link to post
Share on other sites

Hi @Ivan Gretsky - you need to manually set the output mode to "DEVELOPMENT" to make the User Switcher work. I initially set it up this way as an additional security layer, but I am thinking about revising the need to do this.

Let me know if you still have any problems.

  • Like 2

Share this post


Link to post
Share on other sites

Good! That did work.

  1. Are there any string reasons why not allow it for DETECT mode?
  2. Does it allow to switch to default guest user somehow?

Share this post


Link to post
Share on other sites
Just now, Ivan Gretsky said:

Are there any string reasons why not allow it for DETECT mode?

I was trying to be extra cautious just in case someone could spoof DETECT mode, although I don't really think that is an issue - I will revisit this sometime soon, because it would be nice if this was always available.

2 minutes ago, Ivan Gretsky said:

Does it allow to switch to default guest user somehow?

Use the "Logout" button - that will log you out so you are a "guest", but still keep the Tracy debug bar available and keep the User Switcher session alive.

Feel free to post any suggestions for improvements as you play around with this.

  • Like 2

Share this post


Link to post
Share on other sites
1 minute ago, Ivan Gretsky said:

There is no one-click way to log in again, is it?

Of course - just choose a different user and click "Switch".

Don't forget to set a session length before initially clicking Logout though so that the User Switcher is activated in the first place.

Sorry if it's not totally intuitive - I haven't had much feedback on this feature yet.

Share this post


Link to post
Share on other sites

Hi, anybody knows what is it? New "previous" lines comes and stays. How to disable this behavior?

LFiSOjF[1].png

Share this post


Link to post
Share on other sites

@M.O.Z.G - I think you must be running the Legacy version of the Tracy core? Do you have PHP 5.4+ so you can run the Master version?

That said, I still don't know why all those "previous" bars are staying like that. Do they go away if you clear the PW session (log out and back in again)? Does the problem continue after that? When did this start happening for you - was it a PW or Tracy upgrade, or a move to a new server? Any unusual session settings on the server?

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By joshua
      This module is (yet another) way for implementing a cookie management solution.
      Of course there are several other possibilities:
      - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/
      - https://github.com/webmanufaktur/CookieManagementBanner
      - https://github.com/johannesdachsel/cookiemonster
      - https://www.oiljs.org/
      - ... and so on ...
      In this module you can configure which kind of cookie categories you want to manage:

      You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience.
      Currently there are four possible cookie groups:
      - Necessary (always enabled)
      - Statistics
      - Marketing
      - External Media
      All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ...
      When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax:
      <script type="text/plain" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The type has to be "optin" to get recognized by PrivacyWire, the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision.
      If you want to give the users the possibility to change their consent, you can use the following Textformatter:
      [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie.
      You can also add a custom link to output the banner again with a link / button with following class:
      <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> This module is still in development, but we already use it on several production websites.
      You find it here: PrivacyWire Git Repo
      Download as .zip
      I would love to hear your feedback 🙂
      CHANGELOG
      0.1.1 Debugging: fixed error during uninstall 0.1.0 Added new detection of async scripts for W3C Validation 0.0.6 CSS-Debugging for hiding unused buttons, added ProCache support for the JavaScript tag 0.0.5 Multi-language support included completely (also in TextFormatter). Added possibility to async load other assets (e.g. <img type="optin" data-category="marketing" data-src="https://via.placeholder.com/300x300">) 0.0.4 Added possibility to add an imprint link to the banner 0.0.3 Multi-language support for module config (still in development) 0.0.2 First release 0.0.1 Early development
    • By bernhard
      --- Please use RockFinder3 ---
    • By MoritzLost
      Cacheable Placeholders
      This module allows you to have pieces of dynamic content inside cached output. This aims to solve the common problem of having a mostly cacheable site, but with pieces of dynamic output here and there.  Consider this simple example, where you want to output a custom greeting to the current user:
      <h1>Good morning, <?= ucfirst($user->name) ?></h1> This snippet means you can't use the template cache (at least for logged-in users), because each user has a different name. Even if 99% of your output is static, you can only cache the pieces that you know won't include this personal greeting. A more common example would be CSRF tokens for HTML forms - those need to be unique by definition, so you can't cache the form wholesale.
      This module solves this problem by introducing cacheable placeholders - small placeholder tokens that get replaced during every request. The replacement is done inside a Page::render hook so it runs during every request, even if the response is served from the template cache. So you can use something like this:
      <h1>Good morning, {{{greeting}}}</h1> Replacement tokens are defined with a callback function that produces the appropriate output and added to the module through a simple hook:
      // site/ready.php wire()->addHookAfter('CachePlaceholders::getTokens', function (HookEvent $e) { $tokens = $e->return; $tokens['greeting'] = [ 'callback' => function (array $tokenData) { return ucfirst(wire('user')->name); } ]; $e->return = $tokens; }); Tokens can also include parameters that are parsed and passed to the callback function. There are more fully annotated examples and step-by-step instructions in the README on Github!
      Features
      A simple and fast token parser that calls the appropriate callback and runs automatically. Tokens may include multiple named or positional parameters, as well as multi-value parameters. A manual mode that allows you to replace tokens in custom pieces of cached content (useful if you're using the $cache API). Some built-in tokens for common use-cases: CSRF-Tokens, replacing values from superglobals and producing random hexadecimal strings. The token format is completely customizable, all delimiters can be changed to avoid collisions with existing tag parsers or template languages. Links
      Github Repository & documentation Module directory (pending approval) If you are interested in learning more, the README is very extensive, with more usage examples, code samples and usage instructions!
    • By Craig
      I've been using Fathom Analytics for a while now and on a growing number of sites, so thought it was about time there was a PW module for it.
      WayFathomAnalytics
      WayFathomAnalytics is a group of modules which will allow you to view your Fathom Analytics dashboard in the PW admin panel and (optionally) automatically add and configure the tracking code on front-end pages.
      Links
      GitHub Readme & documentation Download Zip Modules directory Module settings screenshot What is Fathom Analytics?
      Fathom Analytics is a simple, privacy-focused website analytics tool for bloggers and businesses.

      Stop scrolling through pages of reports and collecting gobs of personal data about your visitors, both of which you probably don't need. Fathom is a simple and private website analytics platform that lets you focus on what's important: your business.
      Privacy focused Fast-loading dashboards, all data is on a single screen Easy to get what you need, no training required Unlimited email reports Private or public dashboard sharing Cookie notices not required (it doesn't use cookies or collect personal data) Displays: top content, top referrers, top goals and more
    • By daniels
      This is a lightweight alternative to other newsletter & newsletter-subscription modules.
      You can find the Module in the Modules directory and on Github
      It can subscribe, update, unsubscribe & delete a user in a list in Mailchimp with MailChimp API 3.0. It does not provide any forms or validation, so you can feel free to use your own. To protect your users, it does not save any user data in logs or sends them to an admin.
      This module fits your needs if you...
      ...use Mailchimp as your newsletter / email-automation tool ...want to let users subscribe to your newsletter on your website ...want to use your own form, validation and messages (with or without the wire forms) ...don't want any personal user data saved in any way in your ProcessWire environment (cf. EU data regulation terms) ...like to subscribe, update, unsubscribe or delete users to/from different lists ...like the Mailchimp UI for creating / sending / reviewing email campaigns *I have only tested it with PHP 7.x so far, so use on owners risk
      EDIT:
      Since 0.0.4, instructions and changelog can be found in the README only. You can find it here  🙂
      If you have questions or like to contribute, just post a reply or create an issue or pr on github, thanks!
×
×
  • Create New...