adrian

Module
Tracy Debugger

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

 

 

4 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

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 FIA2008
      How can I change the output of `Page::render`?
      I've created a hook before page::render, but when I set the $event->return to something else, my whole page is replaced with that value.
      For example:
       
      public function beforePageRender(HookEvent $event) { $event->return = 'blaat'; } This will cause my whole page to be nothing more than just 'blaat'.
      What I want, is that my menu, footer etc. are still visible but only the content of that page is replaced.
    • By kixe
      Today I have been running in mysql errors using @renobird s Module MarkupActivityLog which still uses mysqli Driver.
      @all developers
      Although mysqli is still supported PDO driver is the default database driver in PW since https://processwire.com/about/news/introducing-processwire-2.4/
      and its strongly recommend to all module authors to use/change-to PDO driver instead of mysqli.

      @renobird I have sent a pull request.
       
    • By Nurguly Ashyrov
      NOTE: This thread originally started in the Pub section of the forum. Since we moved it into the Plugin/Modules section I edited this post to meet the guidelines but also left the original content so that the replies can make sense.  
      ProcessGraphQL
      ProcessGraphQL seamlessly integrates to your ProcessWire web app and allows you to serve the GraphQL api of your existing content. You don't need to apply changes to your content or it's structure. Just choose what you want to serve via GraphQL and your API is ready.
      Warning: The module supports PHP version >= 5.5 and ProcessWire version >= 3.
      Links:
      Zip Download Github Repo ScreenCast  
      At this moment the module is not available from the modules section. Please refer to the Readme to learn more about how to use the module.
       
      Original post starts here...
      Hi Everyone! I became very interested in this GraphQL thing lately and decided to learn a bit about it. And what is the better way of learning a new thing than making a ProcessWire module out of it! 
      For those who are wondering what GraphQL is, in short, it is an alternative to REST. I couldn't find the thread but I remember that Ryan was not very happy with the REST and did not see much value in it. He offered his own AJAX API instead, but it doesn't seem to be supported much by him, and was never published to official modules directory. While ProcessWire's API is already amazing and allows you to quickly serve your content in any format with less than ten lines of code, I think it might be convenient to install a module and have JSON access to all of your content instantly. Especially this could be useful for developers that use ProcessWire as a framework instead of CMS.
      GraphQL is much more flexible than REST. In fact you can build queries in GraphQL with the same patterns you do with ProcessWire API.
      Ok, Ok. Enough talk. Here is what the module does after just installing it into skyscrapers profile.

      It supports filtering via ProcessWire selectors and complex fields like FieldtypeImage or FieldtypePage. See more demo here
      The module is ready to be used, but there are lots of things could be added to it. Like supporting any type of fields via third party modules, authentication, permissions on field level, optimization and so on. I would love to continue to develop it further if I would only know that there is an interest in it. It would be great to hear some feedback from you. I did not open a thread in modules section of the forum because I wanted to be sure there is interest  in it first.
      You can install and learn about it more from it's repository. It should work with PHP >=5.5 and ProcessWire 3.x.x. The support for 2.x.x version is not planned yet.
      Please open an issue if you find bugs or you want some features added in issue tracker. Or you can share your experience with the module here in this thread.
    • By Macrura
      Released:
      http://modules.processwire.com/modules/jquery-ion-range-slider/
      The built in rangeslider is good, but it is somewhat limited if you need really specific slider interfaces, like with pips and showing the value on the handles.
      There are many Jquery rangesliders, but one of the best and easiest to implement is the ion.rangeSlider.
      http://ionden.com/a/plugins/ion.rangeSlider/en.html
      This is a preview of the very simple module that basically allows you to enable the ion.Rangeslider on any text input, and then you type in your params into the textarea field (careful, you can break the page's javascrpt if you are not careful!) There are way too many options to really make this configurable, so the easiest way it to have a free text field where you enter any params. The params are just passed to the instance of the slider.
      Features of ion.Rangeslider:
      Skin support. (5 skins included and PSD for skin creation) Any number of sliders at one page without conflicts and big performance problems Two slider types single (1 slider) and double (2 sliders) Support of negative and fractional values Ability to set custom step and snap grid to step Support of custom values diapason Customisable grid of values Ability to disable UI elements (min and max, current value, grid) Postfixes and prefixes for your numbers ($20, 20 € etc.) Additional postfix for maximum value (eg. $0 — $100+) Ability to prettify large numbers (eg. 10000000 -> 10 000 000 or 10.000.000) Slider writes its value right into input value field. This makes it easy to use in any html form Any slider value can be set through input data-attribute (eg. data-min="10") Slider supports disable param. You can set it true to make slider inactive Slider supports external methods (update, reset and remove) to control it after creation For advanced users slider has callbacks (onStart, onChange, onFinish, onUpdate). Slider pastes all its params to callback first argument as object Slider supports date and time  
      Screenshots comparing Inputfield Rangeslider (Soma) vs. JqueryIonRangeSlider...
      1) basic range using currency
      '
      Same with different skin

      Range of years

      Same with narrower column and different skin..

       
      the module is functional and being used on 1 site, but some additional testing is needed...
    • By FIA2008
      I'm using PHPdocumentor to generate documentation of my modules, but it fails to scan the .module files. Is there another way of making processwire see a module other than giving it a .module extension?
      I'd like to rename my module file to .php but then processwire no longer sees my module.