Jump to content

Tracy Debugger


adrian

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!

Link to comment
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

Link to comment
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
Link to comment
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.

Link to comment
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?

Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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?

Link to comment
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}

 

Link to comment
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

Link to comment
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?

Link to comment
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
Link to comment
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"}

 

Link to comment
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
Link to comment
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
Link to comment
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

Link to comment
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
Link to comment
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?

Link to comment
Share on other sites

  • adrian pinned and locked this topic
  • adrian unpinned and pinned this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By monollonom
      (once again I was surprised to see a work of mine pop up in the newsletter, this time without even listing the module on PW modules website 😅. Thx @teppo !)
      FieldtypeQRCode
      Github: https://github.com/romaincazier/FieldtypeQRCode
      Modules directory: https://processwire.com/modules/fieldtype-qrcode/
      A simple fieldtype generating a QR Code from the public URL of the page, and more.
      Using the PHP library QR Code Generator by Kazuhiko Arase.

      Options
      In the field’s Details tab you can change between .gif or .svg formats. If you select .svg you will have the option to directly output the markup instead of a base64 image. SVG is the default.
      You can also change what is used to generate the QR code and even have several sources. The accepted sources (separated by a comma) are: httpUrl, editUrl, or the name of any text/URL/file/image field.
      If LanguageSupport is installed the compatible sources (httpUrl, text field, ...) will return as many QR codes as there are languages. Note however that when outputting on the front-end, only the languages visible to the user will be generated.
      Formatting
      Unformatted value
      When using $page->getUnformatted("qrcode_field") it returns an array with the following structure:
      [ [ "label" => string, // label used in the admin "qr" => string, // the qrcode image "source" => string, // the source, as defined in the configuration "text" => string // and the text used to generate the qrcode ], ... ] Formatted value
      The formatted value is an <img>/<svg> (or several right next to each other). There is no other markup.
      Should you need the same markup as in the admin you could use:
      $field = $fields->get("qrcode_field"); $field->type->markupValue($page, $field, $page->getUnformatted("qrcode_field")); But it’s a bit cumbersome, plus you need to import the FieldtypeQRCode's css/js. Best is to make your own markup using the unformatted value.
      Static QR code generator
      You can call FieldtypeQRCode::generateQRCode to generate any QR code you want. Its arguments are:
      string $text bool $svg Generate the QR code as svg instead of gif ? (default=true) bool $markup If svg, output its markup instead of a base64 ? (default=false) Hooks
      Please have a look at the source code for more details about the hookable functions.
      Examples
      $wire->addHookAfter("FieldtypeQRCode::getQRText", function($event) { $page = $event->arguments("page"); $event->return = $page->title; // or could be: $event->return = "Your custom text"; }) $wire->addHookAfter("FieldtypeQRCode::generateQRCodes", function($event) { $qrcodes = $event->return; // keep everything except the QR codes generated from editUrl foreach($qrcodes as $key => &$qrcode) { if($qrcode["source"] === "editUrl") { unset($qrcodes[$key]); } } unset($qrcode); $event->return = $qrcodes; })
    • By Sebi
      AppApiFile adds the /file endpoint to the AppApi routes definition. Makes it possible to query files via the api. 
      This module relies on the base module AppApi, which must be installed before AppApiFile can do its work.
      Features
      You can access all files that are uploaded at any ProcessWire page. Call api/file/route/in/pagetree?file=test.jpg to access a page via its route in the page tree. Alternatively you can call api/file/4242?file=test.jpg (e.g.,) to access a page by its id. The module will make sure that the page is accessible by the active user.
      The GET-param "file" defines the basename of the file which you want to get.
      The following GET-params (optional) can be used to manipulate an image:
      width height maxwidth maxheight cropX cropY Use GET-Param format=base64 to receive the file in base64 format.
    • By MarkE
      This fieldtype and inputfield bundle was built for storing measurement values within a field, rendering them in a variety of formats and converting them to other units or otherwise modifying them via the API.
      The API consists of a number of predefined functions, some of which include...
      render() for rendering the measurement object, valueAs() for converting the value to another unit value, convertTo() for converting the whole measurement object to different units, and add() and subtract() for for modifying the stored value by the value (converted as required) in another measurement. In the admin the inputfield includes a checkbox (which can be optionally disabled) for converting values on page save. For an example if a value was typed in as centimeters, the unit was changed to metres, and the page saved with this checkbox selected, said value would be automatically converted so that e.g. 170 cm becomes 1.7 m.

      A simple length field using Fieldtype Measurement and Inputfield Measurement.
      Combination units (e.g. feet and inches) are also supported.
      Please note that this module is 'proof of concept' at the moment - there are limited units available and quite a lot of code tidying to do. More units will be added shortly.
      See the GitHub at https://github.com/MetaTunes/FieldtypeMeasurement for full details and updates.
    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
    • By tcnet
      This module implements the website live chat service from tawk.to. Actually the module doesn't have to do much. It just need to inserted a few lines of JavaScript just before the closing body tag </body> on each side. However, the module offers additional options to display the widget only on certain pages.
      Create an account
      Visit https://www.tawk.to and create an account. It's free! At some point you will reach a page where you can copy the required JavaScript-code.

      Open the module settings and paste the JavaScript-code into the field as shown below. Click "Submit" and that's all.

      Open the module settings
      The settings for this module are located int the menu Modules=>Configure=>LiveChatTawkTo.

       
×
×
  • Create New...