adrian

Tracy Debugger

Recommended Posts

Hey @adrian, thanks for the update.

At the moment  Tracy doesnt check whether ready.php and finished.php exists or not, and gives this error.

599f2e3f07dfe_ClipboardImage(2).thumb.jpg.3707f3ebb8d98ce55c3bfcea7b985829.jpg

  • Like 2

Share this post


Link to post
Share on other sites
7 minutes ago, abdus said:

Hey @adrian, thanks for the update.

At the moment  Tracy doesnt check whether ready.php and finished.php exists or not, and gives this error.

599f2e3f07dfe_ClipboardImage(2).thumb.jpg.3707f3ebb8d98ce55c3bfcea7b985829.jpg

Sorry about that - should be fixed in the latest version.

  • Like 3

Share this post


Link to post
Share on other sites

More improvements to the Captain Hook panel which I think now makes it the definitive source for browsing and understanding what each hook does. 

You have always been able to click the line number to open the file to the line of the method in your code editor (if you have things set up correctly), but this new version adds the following two new features:

1) Inline documentation for each hook - click method (last column) to expand/collapse the docs:

59a10e50dbb6e_ScreenShot2017-08-25at10_59_21PM.thumb.png.afbaeb678e759506941c96b853edf077.png

 

2) Direct link to PW API reference (from the Class::method link in the first column), eg clicking on "Pages::saved" will take you directly to this page:

59a10ed3ac07d_ScreenShot2017-08-25at11_01_29PM.png.0ba1a31c5726858c83f65ef23c4c1164.png

  • Like 8

Share this post


Link to post
Share on other sites

Another small update for Captain Hook.

Now if you have Ryan's ProcessWire API Explorer module installed, the Class::method link will take you to the appropriate page of the API Explorer interface, rather than to the processwire.com API docs page.

This means it will work offline, and of course also means it will be updated to the version of PW running on your site.

  • Like 4

Share this post


Link to post
Share on other sites

Yep - another Captain Hook update. Often hookable methods for a class are derived from a parent class.

Take the "Roles" class for example. It lists add, delete, & save as the hookable methods that are available. But because it extends the "PagesType" class, its hookable methods are also available from the "Roles" class, eg: Roles::deleted.

To make these derived methods easier to find, I have added a new:

ClassName extends ParentClassName line to each file section. Both names are also linked directly to the API docs so you can find out more info there as well.

59a7021ac257c_ScreenShot2017-08-30at11_20_54AM.png.0f829a24b0a0e6d28fcd2eda443b89a1.png

  • Like 5

Share this post


Link to post
Share on other sites

hi adrian,

just updated tracy from the version before the console ready.php include and now i got an error

Call to a member function addHookAfter() on null

because i add my hooks like this:

  // set all languages active automatically
  $wire->addHookAfter('Pages::added', function($event) {
    $page = $event->arguments(0);
    foreach ($this->wire->languages as $lang) $page->set("status$lang", 1);
    $page->save();
  });

as quickfix i added this on top of the file:

$wire = $this->wire;

i think it would be nice to have the wire variable available by default. what do you think?

Share this post


Link to post
Share on other sites

hi adrian, me again :)

just wanted to try captain hook and got a memory error with the default 128M php setting:

Quote

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /var/www/vhosts/.../httpdocs/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/CaptainHook/CaptainHookSearch.php on line 47

setting it to 256M helped but I'm not sure why this happend or if tracy should also work with 128M of memory and this is a bug?

Share this post


Link to post
Share on other sites

Hi @bernhard - that $wire issue is interesting. I will take a look soon.

As far as the memory limit issue with Captain Hook - I reduced my memory down to 64MB and it still worked. I had to go to 32MB to get the error so I am wondering what file caused the error on your system. Could you please debug the path of $file in this function: https://github.com/adrianbj/TracyDebugger/blob/8b92a7d6aec5d9999a77f591496fe8b3ed32080b/panels/CaptainHook/CaptainHookSearch.php#L44

Hopefully that last one to be output should be the file that is causing the limit to be reached. That will at least give me an idea of what is going on. I could of course just set a higher memory limit for this panel, but would like to see what is causing it to fail first.

Thanks!

Share this post


Link to post
Share on other sites

Hey @bernhard - I took another look at the $wire variable not being available in ready.php (and init.php / finished.php) and this has been fixed in the latest version. Please confirm it all works at your end please.

  • Like 4

Share this post


Link to post
Share on other sites

Small update to the ProcessWire Info panel which adds a new redirecting "Login" button. 

Obviously this is only relevant if you have checked the "Force Guest Users into Development Mode on Localhost" option in the config settings. I always do this because I like the Tracy debug bar enabled whether I am logged in or not when developing. 

The nice thing about this login button is that it redirects to the page you were on when you clicked it, so you can be viewing a page on the frontend of your site, click this button, enter your credentials and you will be automatically redirected back to the page you were viewing.

Showing the login button:

59b612ae81d09_ScreenShot2017-09-10at9_35_42PM.png.710c3b0c78f7f15a112426f7b49d6799.png

And if you are already logged in, then you'll get a logout button instead (which also returns you to the current page after logout):

59b6133b7f4ea_ScreenShot2017-09-10at9_38_07PM.png.3c0dcbd326f63ee3f1d8fe770638832d.png

  • Like 2

Share this post


Link to post
Share on other sites
On 9.9.2017 at 7:37 PM, adrian said:

Hi @bernhard - that $wire issue is interesting. I will take a look soon.

As far as the memory limit issue with Captain Hook - I reduced my memory down to 64MB and it still worked. I had to go to 32MB to get the error so I am wondering what file caused the error on your system. Could you please debug the path of $file in this function: https://github.com/adrianbj/TracyDebugger/blob/8b92a7d6aec5d9999a77f591496fe8b3ed32080b/panels/CaptainHook/CaptainHookSearch.php#L44

Hopefully that last one to be output should be the file that is causing the limit to be reached. That will at least give me an idea of what is going on. I could of course just set a higher memory limit for this panel, but would like to see what is causing it to fail first.

Thanks!

sorry no memory issue any more :( is there some caching that i can reset? i had to decrease it to 16MB to get the error...

On 10.9.2017 at 0:20 AM, adrian said:

Hey @bernhard - I took another look at the $wire variable not being available in ready.php (and init.php / finished.php) and this has been fixed in the latest version. Please confirm it all works at your end please.

thanks, works!

  • Like 2

Share this post


Link to post
Share on other sites
4 hours ago, bernhard said:

sorry no memory issue any more :( is there some caching that i can reset? i had to decrease it to 16MB to get the error...

The Captain Hook cache should be reset when you update any modules (including Tracy), or the PW core, so it should already be taken care of, but just in case, go to the database "caches" table and delete the "TracyCaptainHook" row.

4 hours ago, bernhard said:

thanks, works!

Great!

  • Like 1

Share this post


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

go to the database "caches" table and delete the "TracyCaptainHook" row.

Just an idea: could you please implement it in @Soma'Clear Cache Admin and create a pull request for it? You might also want to pull up your sleeves and try to persuade him to register it in the Modules Directory:-[

Or you might just want to integrate his module into Tracy? (At least its features.) ;)

I hope I'm not asking for too much. Thanks for all your great community service as always!!!

  • Like 1

Share this post


Link to post
Share on other sites
31 minutes ago, szabesz said:

Just an idea: could you please implement it in @Soma'Clear Cache Admin and create a pull request for it? You might also want to pull up your sleeves and try to persuade him to register it in the Modules Directory:-[

Or you might just want to integrate his module into Tracy? (At least its features.) ;)

I hope I'm not asking for too much. Thanks for all your great community service as always!!!

 

Soma's module already includes it - it finds all WireCache caches automatically - note "TracyCaptainHook" at the bottom.

59b7f58744849_ScreenShot2017-09-12at7_54_53AM.png.2022367cf5bec81b98b033fcaa6627b6.png

I am tempted to incorporate the features from his module into Tracy - it seems like an appropriate feature to have and I do like having less modules to install/update. I'll have a think on it for a bit!

Anyone else have any strong feelings on this?

  • Like 2

Share this post


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

Soma's module already includes it - it finds all WireCache caches automatically - note "TracyCaptainHook" at the bottom.

Cool, good to know, thanks! I have not yet tried TracyCaptainHook – to tell the truth – so I guess that is why I did not notice it.

6 minutes ago, adrian said:

I'll have a think on it for a bit!

Thanks. It might be useful to have it as a separate module but I do not think editors should use it, so probably it is a good fit for Tracy. Let's see what others say.

Edited by szabesz
...I have not yet tried... + typos
  • Like 1

Share this post


Link to post
Share on other sites

would be nice to have in tracy :)

we got closer! deleted the cache and the error appeared again. last file seems to be /site/modules/RockMpdf/mpdf6/vendor/mpdf/mpdf/mpdf.php - this file has 1,1MB

  • Like 2

Share this post


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

would be nice to have in tracy

That's one +1 vote :)

 

2 minutes ago, bernhard said:

we got closer! deleted the cache and the error appeared again. last file seems to be /site/modules/RockMpdf/mpdf6/vendor/mpdf/mpdf/mpdf.php - this file has 1,1MB

That would explain it - now to figure out how to fix it. Ideally it would be good if libraries included in PW modules were excluded from the Captain Hook search (since there obviously won't be any hookable methods in them), but not sure there is a foolproof way to do that. I think an easy fix (which should work in most cases) is to do an initial check for "___" in the file before scanning fully. This will only fail if a vendor library also uses the three underscore method prefix approach. I'll try this and see how we go.

It's actually a nice speed improvement for the panel (when not cached), so a good thing to do regardless.

Please try the latest version, remembering to clear the cache, and let me know how it goes for you.

  • Like 2

Share this post


Link to post
Share on other sites
6 minutes ago, bernhard said:

version 4.3.22 does not work :(

Do you mean that you are still getting the out of memory error, or something else?

 

Share this post


Link to post
Share on other sites
3 hours ago, bernhard said:

seems to work, thanks :)

Great, thanks for letting me know.

I just committed another update which fixes the issues you were having with the Captain Hook cache not automatically clearing when upgrading Tracy. It will now clear when you upgrade, install, or uninstall any modules, click the modules > refresh button, or change PW core versions.

Also, uninstalled (but not deleted) modules will no longer have their hooks shown.

  • Like 1

Share this post


Link to post
Share on other sites

Hi everyone,

For those of you running the core SessionHandlerDB module, I just committed an experimental fix for the problem of the "Redirect" bar not showing. The redirect bar can be very handy in debugging many things that may otherwise be lost when there is a redirect, so it's been a real shame for those who haven't had it all this time.

59bd49ff1d133_ScreenShot2017-09-16at8_57_07AM.png.0fded13a06e1c8e16251ea68267c44da.png

I discussed the approach of my fix with Ryan and long time ago (I was hoping he might include it in the core) and this was his response to me:

Quote

in experimenting with this stuff in the past, we came across servers that basically halted the PHP after a redirect or connection close header. I never experienced that behavior, but others did.

Basically what the fix does is when a $session->redirect is called, it now makes the header() call before closing down ProcessPageView. The current PW core behavior is to close it down before the redirect.

I don't think it should be an issue for your sites to use this new version because it only makes this change if:

1) SessionHandlerDB is installed
2) The debug bar is enabled

#2 in particular means that regular users won't be impacted by this at all - only users with Tracy permission (typically just superusers).

However if you notice any problems at all, just add this line to your config.php file to disable it.

$config->disableTracySHDBRedirectFix = true;

And, of course let me know if you have problems so I can revisit my decision on incorporating this fix.

  • Like 2

Share this post


Link to post
Share on other sites

Hi @adrian,

Might be a silly question, but just wondering why the dump output doesn't appear in the same order that the dumps occur in. So if I do...

 2017-09-26_183741.png.4acb0f939c4be146152bc5961399a186.png

...how come the output order is reversed?

2017-09-26_183720.png.b8ee4269fbcd5476b36279c8603a0644.png

  • Like 2

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 blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.
    • By BitPoet
      I'm really in love with FormBuilder, but the one thing missing to match all my end users' expectations were repeatable field groups. Think repeaters, in ProcessWire terms. Our primary application of PW is our corporate intranet, so "lines" of fields are quite common in the forms I build. We have all kinds of request forms where the information for a varying number of colleagues needs to be entered (from meal order to flight booking request) and where it is simply impractical to send a form for each, and I don't want to clutter my forms with multiple instances of fields that may only get used ten percent of the time.
      That's why I started to build FormBuilderMultiplier (link to GitHub).
      What it does:
      Adds an option to make a regular Fieldgroup repeatable Lets you limit the number of instances of a Fieldgroup on the form Adds an "Add row" button the form that adds another instance of the Fieldgroup's fields Adds a counter suffix at the end of every affected field's label Stores the entered values just like regular fields Makes the entered values available in preview and email notifications Supports most text based fields, textareas and selects (really, I haven't had enough time to test all the available choices yet) What it doesn't do (yet):
      Support saving to ProcessWire pages (i.e. real Repeaters) I haven't tested all the validation stuff, Date/Time inputs etc. yet, but since I'm utterly swamped with other stuff at work, I didn't want to wait until I have it polished. Any feedback is welcome. There might also be some issues with different output frameworks that I haven't encountered yet. The forms I work with mostly use UIKit.
      Status:
      Still alpha, so test well before using it in the field.
      Known issues:
      When rows are added, the form's iframe needs to be resized, which isn't completely clean yet.
      How it works:
      The Fieldgroup settings are added through regular hooks, as is the logic that adds the necessary field copies for processing the form and displaying previews.
      "Multiplied" field instances are suffixed with _NUM, where NUM is an incremental integer starting from 1. So if you have add two fields named "surname" and "givenname" to a fieldgroup and check the "multiply" checkbox, the form will initially have "surname_1" and "givenname_1" field (I'm still considering changing that to make the risk to shoot oneself into the foot by having a regular "surname_1" field somewhere else in the form less likely).
      When a "row" is added, the first row is cloned through JS and the counter in the fields' IDs, names and "for" attributes as well as the counter in the label are incremented before appending the copies to the Fieldset container in the form.
      To keep backend and frontend in sync, a hidden field named [name of the fieldset]__multiplier_rows is added to the form. Both the backend and the frontend script use this to store and retrieve the number of "rows".
      ToDo:
      Naturally, add the option to store the data in real repeaters when saving to pages. Do a lot of testing (and likely fixing). Make a few things (like the "Add row" button label etc.) configurable in field(set) context. Add a smooth API to retrieve the multiplied values as WireArrays. The mandatory moving screenshot:

    • By MoritzLost
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By adrian
      This module provides a way to rapidly generate Page fields and the required templates and pages for use as a drop down select (or any other Page field type).
      This module will let you create a full page field setup in literally a few seconds 
      To use, run Page Field Select Creator from the Setup Menu
      Enter a Field Title, eg: Room Types Select Options - These will become the child pages that will populate the page field select options. There are two different options.
       
      Option 1. TITLE FIELD ONLY - enter one option per line, eg:
       
      Single
      Double
      Suite
       
       
      Option 2. MULTIPLE FIELDS - the first line is used for the field names and the first field must be 'Title'. Subsequent lines are the values for the fields, eg:
       
      Title, Number of Beds, Number of People, Kitchen Facilities
      Single, 1, 1, Fridge Only
      Double, 2, 2, Fridge Only
      Suite, 3, 6, Full Kitchen
        Choose the parent where the page tree of options will be created, eg a hidden "Options" parent page Select a "Deference in API as" option depending on your needs Choose the input field type Check whether "Allow new pages to be created from field?" should be enabled. As an example, if you entered "Room Types" as the field title, you would end up with all of the following automatically created:
      a fully configured page field called: room_types MULTIPLE FIELDS OPTION - 3 additional fields - number_of_beds, number_of_people, kitchen a parent template called: room_types a child template called: room_types_items (with either just a title field, or with the 3 additional fields as well) a parent page called: Room Types a series of child pages named and titled based on the per line entries in the Select Options textarea The templates are configured such that the "room_types_items" child template can only have the main "room_types" template as a parent, and vice versa.

      Then all you have to do is add the newly created page field to any template you want and you're ready to go!
       
      You can grab it from:
       
      Modules directory: http://modules.processwire.com/modules/process-page-field-select-creator/
      Github: https://github.com/adrianbj/ProcessPageFieldSelectCreator
       

    • By bernhard
      WHY?
      This module was built to fill the gap between simple $pages->find() operations and complex SQL queries.
      The problem with $pages->find() is that it loads all pages into memory and that can be a problem when querying multiple thousands of pages. Even $pages->findMany() loads all pages into memory and therefore is a lot slower than regular SQL.
      The problem with SQL on the other hand is, that the queries are quite complex to build. All fields are separate tables, some repeatable fields use multiple rows for their content that belong to only one single page, you always need to check for the page status (which is not necessary on regular find() operations and therefore nobody is used to that).
      In short: It is far too much work to efficiently and easily get an array of data based on PW pages and fields and I need that a lot for my RockGrid module to build all kinds of tabular data.

      Basic Usage

       
      Docs & Download
      https://modules.processwire.com/modules/rock-finder/
      https://github.com/BernhardBaumrock/RockFinder
       
      Changelog
      180817, v1.0.6, support for joining multiple finders 180810, v1.0.5, basic support for options fields 180528, v1.0.4, add custom select statement option 180516, change sql query method, bump version to 1.0.0 180515, multilang bugfix 180513, beta release <180513, preview/discussion took place here: https://processwire.com/talk/topic/18983-rocksqlfinder-highly-efficient-and-flexible-sql-finder-module/