adrian

Module
Tracy Debugger

953 posts in this topic

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

1 person likes this

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>';
}

 

 

5 people like this

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.

1 person likes this

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

2 people like this

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

1 person likes this

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.

 

1 person likes this

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.

4 people like this

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!

3 people like this

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.

2 people like this

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.

2 people like this

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?

1 person likes this

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 bernhard
      Hi,
      just stumbled over a little module that i built for my last project. it helped me to test performance of my rockdatatables module to generate 3000 random json datasets and i want to share it with you. maybe it saves some time for someone.
      https://gitlab.com/baumrock/RockDummyData/
      easy example:
      $rdd = $modules->get('RockDummyData'); for($i=0; $i<15; $i++) { // this has to be inside the for-loop to always get a new dummy $dummy = $rdd->getDummy(); echo date("d.m.Y H:i:s", $dummy->timestamp) . "<br>"; } more advanced:
      $json = new stdClass(); $json->data = array(); $rdd = $modules->get('RockDummyData'); for($i=0; $i<3000; $i++) { // this has to be inside the for-loop to always get a new dummy $dummy = $rdd->getDummy(); $obj = new stdClass(); $obj->name = $dummy->forename . ' ' . $dummy->surname; $obj->position = $dummy->job; $obj->office = $dummy->city; $obj->color = $dummy->color; $obj->start_date = new stdClass(); $obj->start_date->display = date('d.m.Y',$dummy->timestamp); $obj->start_date->sort = $dummy->timestamp; $obj->salary = rand(0,10000); $json->data[] = $obj; } echo json_encode($json); you have to store your random datasets on your own into the /data folder. there are several services for creating all kinds of random data on the web - if you know one service that allows sharing those datasets let me know and i can include common needed data into the module
    • By AndySh
      Hello!
      I need your assistance please. I purchased the module FormBuilder. Unfortunately, the module discontinued delivering customer submissions to e-mail box specified in the module settings. Direct mailing to the e-mail box works OK. The module settings stays the same and are correct, like "Send e-mail to administrator(s) is checked. The last version of FormBuilder 3.0 has been installed. Please advise how to resolve the issue becase I cannot get orders from customers anymore (((
    • By kixe
      As described in this post (https://processwire.com/talk/topic/8551-custom-urls-for-pages/?p=82742) the option 'Name Format Children' under the tab 'Family' in template settings doesn't work properly and also not as expected. I had a look inside the code and made some changes which are working properly, which offers much more options, more consistency and less code too.

      The result is the following. You have 3 Options for generating name and title, which could be combined in endless variations.
      Name is always derived from title, same like creating pages manually.
      type date: if function detects # character anywhere in the string, conversion will be: deletion of # and string will be used as format parameter for PHP date() function type field: if string is a fieldname of the parent page the value of this field will be used type string: if string doesn't fit to the 2 preceeding it will be taken as it is All parts (separated by comma) will be composed in the order of setting. You can use unlimited numbers of parts

      I made a pull request on github: https://github.com/ryancramerdesign/ProcessWire/pull/831

      Example screenshots

      Setting ...


      will result in


       
    • By kongondo
      FieldtypeRuntimeMarkup and InputfieldRuntimeMarkup
       
      Modules Directory: http://modules.processwire.com/modules/fieldtype-runtime-markup/
      GitHub: https://github.com/kongondo/FieldtypeRuntimeMarkup
       
      This module allows for custom markup to be dynamically (PHP) generated and output within a page's edit screen (in Admin).
       
      The value for the fieldtype is generated at runtime. No data is saved in the database. The accompanying InputfieldRuntimeMarkup is only used to render/display the markup in the page edit screen.
       
      The field's value is accessible from the ProcessWire API in the frontend like any other field, i.e. it has access to $page and $pages.
       
      The module was commissioned/sponsored by @Valan. Although there's certainly other ways to achieve what this module does, it offers a dynamic and flexible alternative to generating your own markup in a page's edit screen whilst also allowing access to that markup in the frontend. Thanks Valan!
       
      Warning/Consideration
      Although access to ProcessWire's Fields' admin pages is only available to Superusers, this Fieldtype will evaluate and run the custom PHP Code entered and saved in the field's settings (Details tab). Utmost care should therefore be taken in making sure your code does not perform any CRUD operations!! (unless of course that's intentional) The value for this fieldtype is generated at runtime and thus no data is stored in the database. This means that you cannot directly query a RuntimeMarkup field from $pages->find(). Usage and API
       
      Backend
      Enter your custom PHP snippet in the Details tab of your field (it is RECOMMENDED though that you use wireRenderFile() instead. See example below). Your code can be as simple or as complicated as you want as long as in the end you return a value that is not an array or an object or anything other than a string/integer.
       
      FieldtypeRuntimeMarkup has access to $page (the current page being edited/viewed) and $pages. 
       
      A very simple example.
      return 'Hello'; Simple example.
      return $page->title; Simple example with markup.
      return '<h2>' . $page->title . '</h2>'; Another simple example with markup.
      $out = '<h1>hello '; $out .= $page->title; $out .= '</h1>'; return $out; A more advanced example.
      $p = $pages->get('/about-us/')->child('sort=random'); return '<p>' . $p->title . '</p>'; An even more complex example.
      $str =''; if($page->name == 'about-us') { $p = $page->children->last(); $str = "<h2><a href='{$p->url}'>{$p->title}</a></h2>"; } else { $str = "<h2><a href='{$page->url}'>{$page->title}</a></h2>"; } return $str; Rather than type your code directly in the Details tab of the field, it is highly recommended that you placed all your code in an external file and call that file using the core wireRenderFile() method. Taking this approach means you will be able to edit your code in your favourite text editor. It also means you will be able to type more text without having to scroll. Editing the file is also easier than editing the field. To use this approach, simply do:
      return wireRenderFile('name-of-file');// file will be in /site/templates/ If using ProcessWire 3.x, you will need to use namespace as follows:
      return ProcessWire\wireRenderFile('name-of-file'); How to access the value of RuntimeMarkup in the frontend (our field is called 'runtime_markup')
       
      Access the field on the current page (just like any other field)
      echo $page->runtime_markup; Access the field on another page
      echo $pages->get('/about-us/')->runtime_markup; Screenshots
       
      Backend
       

       

       
      Frontend