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 anderson
      Hi all,
      I'm a new to website building. Learned some CRASH course of js,jquery,php. Then I found CMS. Still learning around forum, youtube....
      Anyway, please help me with some beginer questions:
      1, About template - please correct me if I understand wrong : every page should be (or recommended) built on a template. So if in total I'll have 10 pages, 2 of them have same layout, I'll need 9 templates.  And, what fields a page includes, is not defined in page, but defined in the template that page uses. 
      2,  Where to see what modules I've installed? is it in "Modules - Site"? 
      3, I installed "PageTable Extended", then what?  As in a youtube tutorial, it should appear in Setup tab, but it doesn't.  What's in there: templates,fields,logs,comments. (I installed "Uikit 3 site_blog profile".)
      4, I did a search in Processwire website for the famous "repeater matrix" module, and can not find it, there's a Repeater, as well as a Matrix. Is it not a module?
      5, I watched this youtube tuts: https://www.youtube.com/watch?v=IHqnLQy9R1A
      Anybody familiar with this tuts please help: 
      After he analysed a target webpage layout he wanted to mimic, he created some fields, some template, then based on those he created a page and input some "content" in there, then clicked "view", it's just some text. So, here comes my question, he copied a folder "assets" (subfolders are: css,fonts,js,img) over, then the page have the appearance/layout he wanted to mimic. Where does that assets folder come from?
      Appreciate any help.
    • By mtwebit
      I've created a set of modules for importing (manipulating and displaying) data from external resources. A key requirement was to handle large (100k+) number of pages easily.
      Main features
      import data from CSV and XML sources in the background (using Tasker) purge, update or overwrite existing pages using selectors user configurable input <-> field mappings on-the-fly data conversion and composition (e.g. joining CSV columns into a single field) download external resources (files, images) during import handle page references by any (even numeric) fields How it works
      You can upload CSV or XML files to DataSet pages and specify import rules in their description.
      The module imports the content of the file and creates/updates child pages automatically.
      How to use it
      Create a DataSet page that stores the source file. The file's description field specifies how the import should be done:
      After saving the DataSet page an import button should appear below the file description.

      When you start the import the DataSet module creates a task (executed by Tasker) that will import the data in the background.
      You can monitor its execution and check its logs for errors.

      See the module's wiki for more details.
      The module was already used in three projects to import and handle large XML and CSV datasets. It has some rough edges and I'm sure it needs improvement so comments are welcome.
    • By dreerr
      TemplateEnginePug (formally TemplateEngineJade)
       
      This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates.
      doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug
      Project in modules directory: modules.processwire.com/modules/template-engine-pug/
       
      For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.
       
    • By Robin S
      Pages At Bottom
      Keeps selected pages at the bottom of their siblings.
      A "bottom page" will stay at the bottom even if it is drag-sorted to a different location or another page is drag-sorted below it (after Page List is refreshed the bottom page will still be at the bottom).
      Newly added sibling pages will not appear below a bottom page.
      The module also prevents the API methods $pages->sort() and $pages->insertAfter() from affecting the position of bottom pages.
      Note: the module only works when the sort setting for children on the parent page/template is "Manual drag-n-drop".
      Why?
      Because you want some pages to always be at the bottom of their siblings for one reason or another. And someone requested it. 🙂
      Usage
      Install the Pages At Bottom module.
      Select one or more pages to keep at the bottom of their siblings. If you select more than one bottom page per parent then their sort order in the page list will be the same as the sort order in the module config.

       
      https://github.com/Toutouwai/PagesAtBottom
      https://modules.processwire.com/modules/pages-at-bottom/
    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/