adrian

Tracy Debugger

Recommended Posts

3 hours ago, netcarver said:

I'd like to report that I had a recent differential backup that was growing rather fast, and it turned out to be tracy files in the session directory of the site.

Hi Steve,

Are you talking about PHP's session folder, or PW's /site/assets/sessions/ ?

For the former, should PHP's garbage collection take care of that?

For the latter, I see I have a few (5) old "tracy.0e3b49e668" files from Apr and May 2016, but none more recent. I wonder if this is an old issue that has been fixed. It sounds like you are still seeing new additions though?

Could you provide more details on the age of these files, and also your OS, PHP version, etc?

Thanks!

Share this post


Link to post
Share on other sites

Hi Adrian,

Sorry, I meant site/assets/sessions/ and the tracy* files within that. At one point there were thousands of megabyte-size files in there. The site this happened on is running Tracy 3.5.5 on PW 3.0.42.

OS: Arch linux. PHP: 7.1

Irony of moment: I disabled Tracy, then I deleted the tracy* files AND recreated the backup set, deleting the differentials. I've been back into the admin area and tried re-enabling Tracy, but I'm not seeing the files being created now - suggesting it might have been from an older version of the module (this is a site I use to experiment with new PW stuff, so it has seen multiple revisions of Tracy installed over the months.) If the issue recurs I shall, of course, let you know more.

Regards,
Steve

Share this post


Link to post
Share on other sites

Thanks Steve - yes please let me know if it shows up again, but I hopefully it was an old issue that isn't present in the current version.

Share this post


Link to post
Share on other sites

Tracy went to language school!

Now she shows page titles and names in the current language, along with the title and name of that language in the Summary section.

And she has a completely new Language Info section showing a summary of the title, name and active status of each language. Hopefully this should help to debug why something is not showing on the front-end.

58b74d1263ef3_ScreenShot2017-03-01at2_36_11PM.thumb.png.309f0a72622505563e378122fd096e17.png

The ⓘ icon highlights titles/names that are missing in the current language. It shows the default title/name instead, along with this icon.

Let me know if you notice any problems!

 

  • Like 5

Share this post


Link to post
Share on other sites

Hi there, thanks for the great module.

I installed it on PW 3.0.33 with PHP 5.4.45 and I get an error message:

Fatal error: Call to undefined method stdClass::getIterator() in /home/funevents/public_html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/DebugModePanel.php on line 422

Is there something missing on my server? Thanks.

Share this post


Link to post
Share on other sites

Good day!

This module is in such a rapid development bringing tons of new awesomeness I just can't keep the pace even reading this thread :rolleyes:. After upgrade (from a rather old version) the frontend panel stopped working for non-superusers. I figured out I need to create tracy-debugger permission and assign it to every role I want to test the site with. And probably remove the assignment on a live site (maybe only if it is in DEVELOPMENT mode).

I often debug under different roles. Is the way described above the right one for it? Or there are some shortcuts? Maybe I am missing something obvious?

Share this post


Link to post
Share on other sites

@Jozsef - I'll look into that shortly.

@Ivan Gretsky - Yeah, I did change behaviour slightly there. Previously the debug bar would display in DETECT mode on a local dev environment even without the "tracy-debugger" permission. Even though as far as I know it isn't possible to spoof $_SERVER['REMOTE_ADDR'], I thought it still might be a little confusing/concerning to users. I would be happy to bring this back as an option though. I'd add a new config setting checkbox that says - "Force development mode for guests when DETECT determines localhost", or something like that. Would that be helpful for your workflow?

On the issue of debugging under different roles, don't forget about the User Switcher panel which allows you to switch to any user (including logged out as guest) and still have the debug bar enabled.

 

  • Like 2

Share this post


Link to post
Share on other sites

@Jozsef - that error should be fixed in the latest version - please let me know if you have any more problems with it.

@Ivan Gretsky - latest version adds that new setting - let me know if it works as expected. I also added to/revised the explanatory text for the various access settings in the hopes of makes it easier to understand.

Cheers,
Adrian

  • Like 3

Share this post


Link to post
Share on other sites
6 hours ago, Ivan Gretsky said:

I just can't keep the pace even reading this thread

I wish there was a supported way to display a simple CHANGELOG that comes with a module. Other CMSes utilize this dead simple but very useful feature. I wonder why we have to live without it. Once I pointed this out, but only four of us seem to care including @adrian, of course :) Why are people are so uninterested in this? Strange.

Last time I spent at least 5 minutes to find the "Admin Style" option of Tracy because it was renamed to "Server Type Indicator". A simple message like "Admin Style was renamed to Server Type Indicator" would have saved me the hassle. There are so many settings of Tracy that I often get lost, especially when things are renamed or moved around.

  • Like 3

Share this post


Link to post
Share on other sites

@szabesz - firstly, sorry for renaming that setting on you :)

I just posted a response in that Wishlist thread - I agree that we need this badly - I have added some suggestions for how, and also to include a "Breaking changes" flag in the ProcessWire Upgrades module, which I also think is important.

  • Like 3

Share this post


Link to post
Share on other sites

Hi @adrian,

Is there a way to tell the debug bar not to appear on pages with a particular template? The situation is that I'd like to be able to turn off the debug bar for the Form Builder template that is used when the form is rendered inside an iframe. I know there is an option to disable the debug bar in modals, but not for iframes I think? And it's often useful to have the debug bar in iframes so it would be great to be able to target templates rather than all iframes.

Any thoughts on this?

Share this post


Link to post
Share on other sites

Hi @Robin S - You're right, there is no option to not show it in an iframe. I am definitely happy to add an option for selected templates though. I'll see what I can do about getting this done for you tomorrow.

  • Like 2

Share this post


Link to post
Share on other sites

@Robin S - I just committed a new version with the template restriction options.

Let me know if you have any problems.

Cheers,
Adrian

  • Like 2

Share this post


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

I just committed a new version with the template restriction options.

Thanks for implementing this so quickly.

The template restriction works if I select a template such as "home" or "basic-page", but it doesn't work for the "form-builder" template for some reason. The debug bar still appears on the Form Builder page when it is loaded in an iframe and when the page is loaded directly.

I'm also seeing an error in the Captain Hook panel which may or may not be related:

ErrorException: Undefined offset: 2 in D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\CaptainHookPanel.php:111
Stack trace:
#0 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\CaptainHookPanel.php(111): Tracy\Bar->Tracy\{closure}(8, 'Undefined offse...', 'D:\\Websites\\__w...', 111, Array)
#1 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Bar.php(153): CaptainHookPanel->getPanel()
#2 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Bar.php(108): Tracy\Bar->renderPanels()
#3 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Debugger.php(266): Tracy\Bar->render()
#4 [internal function]: Tracy\Debugger::shutdownHandler()
#5 {main}

 

Share this post


Link to post
Share on other sites

Hi @Robin S - sorry it's not working for the form-builder template. I don't use ForBuilder so a little hard to debug, but I'll take a look and see what I can figure out.

Regarding the Captain Hook error - no, not related - I added some code recently to split the files into sections - that is what is causing the error for you, but still not sure why you are getting that. Any chance you could debug what the contents of $segments is when the undefined offset is reported?

Thanks,
Adrian

Share this post


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

Any chance you could debug what the contents of $segments is when the undefined offset is reported?

I think the error is down to the Windows directory separator thing that reared its head a while ago. If I json_encode and log $segments I see results like this:

2017-03-09_211833.png.beb2c5399d6566cc412e726c1f4e9186.png

Not sure why there would be double slashes there instead of single slashes.

If I change line 110 to be...

$segments = explode(DIRECTORY_SEPARATOR, $path);

...then the panel error is fixed, although I notice that the 'wire' segment still looks a bit funky:

2017-03-09_211939.png.ff53a67576789b78014e7013808d5b00.png

Maybe there are other places where a hardcoded forward slash should be replaced with the DIRECTORY_SEPARATOR constant?

 

24 minutes ago, adrian said:

I don't use ForBuilder so a little hard to debug

I don't mean to get OT here, but I'm curious how you like to handle front-end forms if you don't use Form Builder. Do you use the forms API, or a third-party forms library like Nette Forms, or some other approach?

Share this post


Link to post
Share on other sites

Thanks @Robin S - I am bad at remembering that :)

New version should fix everything and should also take care of that extra "\/" that you saw at the start. Can you please confirm that your CaptainHook panel output now looks like this - note the "Site Modules" (along with "Wire Core" and "Wire Modules" section headers) and the way the files now start with just their main folder, eg:

AdminCustomFiles/AdminCustomFiles.module compared with the old: /site/modules/AdminCustomFiles/AdminCustomFiles.module

I think this new way makes it much easier to scroll down to find what you are looking for.

58c1692c6d696_ScreenShot2017-03-09at6_39_18AM.png.1d39e9f76441127cb8416a24d2af74ae.png

 

Regarding FormBuilder - yes, I use the forms API.

I'll see what I can do about figuring out what the issue might be with the template detection shortly. I have a hunch that it's related to the way I am getting the template of the page - because I am in ini() and not ready() when I need to do this, it's a bit of a hack :)

  • Like 2

Share this post


Link to post
Share on other sites

@Robin S

Ok, back to the form builder issue. Please try out the attached version. I want to test myself a little more today before committing because I had to move a few things around to get this working.

Please let me know how it goes.

 

TracyDebugger.zip

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, adrian said:

Please let me know how it goes.

Captain Hook panel is working and removing the debug bar on the Form Builder template is also working. Thanks!

However, there is a new panel error:

ErrorException: A non well formed numeric value encountered in D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\panels\ProcesswireInfoPanel.php:359
Stack trace:
#0 [internal function]: Tracy\Bar->Tracy\{closure}(8, 'A non well form...', 'D:\\Websites\\__w...', 359, Array)
#1 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\panels\ProcesswireInfoPanel.php(359): date('Y-m-d H:i:s', '2017-03-02 21:3...')
#2 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Bar.php(153): ProcesswireInfoPanel->getPanel()
#3 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Bar.php(108): Tracy\Bar->renderPanels()
#4 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Debugger.php(266): Tracy\Bar->render()
#5 [internal function]: Tracy\Debugger::shutdownHandler()
#6 {main}

If I log $val before line 359 I get this:

$val: {"pages_id":"1054","data":"dreamstimefree_5848146.jpg","sort":"2","description":"","modified":"2017-03-02 21:39:29","created":"2017-03-02 21:39:29"}

 

Share this post


Link to post
Share on other sites

Hi @Robin S - thanks for confirming the Captain Hook and form builder template fixes.

That issue on the PW Info panel is very weird. The created field for that image is already a string rather than a timestamp, but I haven't ever seen that. I know how to fix, but it would be helpful to know why it is like that in the first place - do you have any special settings on that image field? Is the error on all your pages with images?

PS Just did a little testing and it looks like it is likely only with images in repeaters that we even get to this line in the code, but even so, I am still getting a timestamp returned. I would expect it has something to do with outputformatting being on, but I still can't seem to replicate - at thoughts at your end?

  • Like 1

Share this post


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

That issue on the PW Info panel is very weird.

It is weird and not worth spending time on I think. I thought it was some general error but it actually only happens on one page and relates to something I was testing with FieldtypeSelectExtOption and hooks.

The field and hooks apply to several pages containing similar data yet I only got the panel error on one - I tried a few things to narrow it down but couldn't see the cause. Then I removed and readded the Select External Option field to the template and all is well now. So just one of those strange things that spontaneously resolves.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks @Robin S for looking into that - glad it sorted itself out. I am tempted to run a strtotime() on the "created" date before passing it to date() to prevent this from possibly happening, but might wait to see if it appears again before worrying about it.

Cheers,
Adrian

Share this post


Link to post
Share on other sites

Hi @adrian, I was just wondering what location gets scanned for ToDo Items in Tracy?  I'm assuming it is your site's templates directory?

I wonder if you should add node_modules, bower_components, .sass-cache by default?  Seems like if it had to scan all those files it would slow things down a lot?

Maybe you can provide an option to turn that feature off completely?

  • Like 1

Share this post


Link to post
Share on other sites

@gmclelland - yes, by default it is just the files inside /site/templates/ and all it's subfolders, but it can also include /site/modules/ if you've checked that option.

Yes, it is a very good idea to add sass, bower, etc files to the Ignore Directories.

6 minutes ago, gmclelland said:

Maybe you can provide an option to turn that feature off completely?

What feature exactly do you want to turn off?

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 Anssi
      A simple module to enable easy navigation between the public and the admin side of the site. After installation a green bar will appear to the upper side of the screen, containing a few navigation elements and displaying the PW version number.
      Heavily inspired by @apeisa's great AdminBar (Thanks!). I needed a bit simpler tool for my projects and as a result, this was made. Available on GitHub .

    • By Sebi
      I've created a small module which lets you define a timestamp after which a page should be accessible. In addition you can define a timestamp when the release should end and the page should not be accessable any more.
      Github: https://github.com/Sebiworld/PageAccessReleasetime
      Usage
      PageAccessReleasetime can be installed like every other module in ProcessWire. Check the following guide for detailed information: How-To Install or Uninstall Modules
      After that, you will find checkboxes for activating the releasetime-fields at the settings-tab of each page. You don't need to add the fields to your templates manually.
      Check e.g. the checkbox "Activate Releasetime from?" and fill in a date in the future. The page will not be accessable for your users until the given date is reached.
      If you have $config->pagefileSecure = true, the module will protect files of unreleased pages as well.
      How it works
      This module hooks into Page::viewable to prevent users to access unreleased pages:
      public function hookPageViewable($event) { $page = $event->object; $viewable = $event->return; if($viewable){ // If the page would be viewable, additionally check Releasetime and User-Permission $viewable = $this->canUserSee($page); } $event->return = $viewable; } To prevent access to the files of unreleased pages, we hook into Page::isPublic and ProcessPageView::sendFile.
      public function hookPageIsPublic($e) { $page = $e->object; if($e->return && $this->isReleaseTimeSet($page)) { $e->return = false; } } The site/assets/files/ directory of pages, which isPublic() returns false, will get a '-' as prefix. This indicates ProcessWire (with activated $config->pagefileSecure) to check the file's permissions via PHP before delivering it to the client.
      The check wether a not-public file should be accessable happens in ProcessPageView::sendFile. We throw an 404 Exception if the current user must not see the file.
      public function hookProcessPageViewSendFile($e) { $page = $e->arguments[0]; if(!$this->canUserSee($page)) { throw new Wire404Exception('File not found'); } } Additionally we hook into ProcessPageEdit::buildForm to add the PageAccessReleasetime fields to each page and move them to the settings tab.
      Limitations
      In the current version, releasetime-protected pages will appear in wire('pages')->find() queries. If you want to display a list of pages, where pages could be releasetime-protected, you should double-check with $page->viewable() wether the page can be accessed. $page->viewable() returns false, if the page is not released yet.
      If you have an idea how unreleased pages can be filtered out of ProcessWire selector queries, feel free to write an issue, comment or make a pull request!
    • By David Karich
      Thanks to the great Pro module "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use this module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      With this proof of concept I have created a module which adds the feature to copy a repeater item to the clipboard so that you can paste this item to another page with the same repeater field. The module has been developed very rudimentarily so far. It is currently not possible to copy nested items. There is also no check of Min/Max. You can also only copy items that have the same field on different pages. And surely you can solve all this more elegantly with AJAX. But personally I lack the deeper understanding of the repeaters. Also missing on the Javascript side are event triggers for the repeaters, which would make it easier. Like e.g. RepeaterItemInitReady or similar.
      it would be great if @ryan would implement this functionality in the core of RepeaterMatrix. I think he has better ways to implement this. Or what do you think, Ryan?
      Everybody is welcome to work on this module and improve it, if it should not be integrated into the matrix core. Therefore I put it for testing and as download on GitHub: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDublicate
      You can best see the functionality in the screencast: 
       
    • By anderson
      Hi,
      Please take a look at this:
      https://templatemag.com/demo/Good/
      The upper nav bar, including dropdowns like "pages" and "portfolios", what do you call this whole thing? At first I guess it's called "dropdown nav bar", but seems not.
      AND of course, what's the simplest way/module to achieve this in PW?
      Thanks in advance.
    • By Sebi2020
      Hey, I'm new and I created a simple module for tagging pages because I didn't found a module for it (sadly this is not a core feature). This module is licensed under the GPL3 and cames with absolutly no warranty at all. You should test the module before using it in production environments. Currently it's an alpha release. if you like the module or have ideas for improvements feel free to post a comment. Currently this fieldtype is only compatible with the Inputfield I've created to because I haven't found  an Inputfield yet, that returns arrays from a single html input.
      Greetings Sebi2020
      FieldtypeTags.zip.asc
      InputfieldTagify.zip
      InputfieldTagify.zip.asc
      FieldtypeTags.zip