Jump to content

Search the Community

Showing results for 'tracy'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Here is a quick report regarding one of the newest versions. I tested 4.26.42. In this version, the PHP console doesn't work anymore: The output window only shows "0:". Tested on two different hosting providers with three different PW installations. Downgrading to Tracy Debugger 4.26.26 fixes the problem.
  2. I keep getting this error message on all backend and frontend pages in one of my projects: ErrorException: Undefined array key 1 in /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/TracyLogsPanel.php:71 Stack trace: #0 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/TracyLogsPanel.php(71): Tracy\Bar->Tracy\{closure}(2, '...', '...', 71) #1 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(142): TracyLogsPanel->getTab() #2 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(115): Tracy\Bar->renderPanels('') #3 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('...') #4 /var/www/html/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #5 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(314): Tracy\DevelopmentStrategy->renderBar() #6 [internal function]: Tracy\Debugger::shutdownHandler() #7 {main} I am using the newest PW Version and the newest Tracy Debugger Version, can anybody give me a hint what is happening here?
  3. Interesting - does the console panel work when you using it from the PW admin, rather than the frontend of the site? If you can't figure out the issue, perhaps a trial and error approach of going through the Tracy versions to see where the issue starts occurring might be the quickest in the end. Choose a version in the middle between the current, ie 4.26.34 and if that works, split the difference between it and .42 but if it doesn't, go for .30 - you get the idea and hopefully it won't take long to figure out which one breaks things.
  4. Very interesting. The folder only contained only old logs: Logging the bd($entry) revealed an error from 2023 that was actually no longer part of the reay.php anymore. I manually deleted all tracy logs files inside the site/assets/logs/tracy folder and also deleted the cache folder under /assets. After that this error disappeared.
  5. Hi @Stefanowitsch - can you take a look at the *.log files in site/assets/logs/tracy - each line in the files should start with something like this: [2023-07-18 07-59-40] Do any of the files have lines that don't have this? You could also add: bd($entry); after line line 67 in that TracyLogsPanel.php file and review the entries that are dumped to see which one doesn't have the date in that format so we can attempt to figure out how that might have happened.
  6. I have just released version 2 of RockMigrations: GitHub: https://github.com/baumrock/RockMigrations Modules Directory: https://processwire.com/modules/rock-migrations/ Please star the module on GitHub if you like it ? Are you unsure if RockMigrations is the right tool for you? @Jonathan Lahijani in a very nice PM ? Read the full post here Read the full post here Read the full post here QuickStart The example code uses bd() calls for dumping data. You need TracyDebugger installed! Put this in your site/migrate.php /** @var RockMigrations $rm */ $rm = $modules->get("RockMigrations"); bd('Create field + template via RM'); $rm->createField('demo', 'text', [ 'label' => 'My demo field', 'tags' => 'RMDemo', ]); $rm->createTemplate('demo', [ 'fields' => [ 'title', 'demo', ], 'tags' => 'RMDemo', ]); Reload your site and you will see the new field and template in the backend and you'll see the message in the tracy debug bar.
  7. Hi, Related to this thread I started recently, I wanted to follow up and check on the expected behavior for the Tracy Debugger Console. In my template files, there was a preg_replace operation on the $page->body property. The TD Console showed the result of this template operation after executing "echo $page->body". Is this the normal / expected behavior, as opposed to simply showing the field HTML content from the DB? The DB itself showed the unchanged HTML for the body field. Just wanted to check since it will help me understand how to troubleshoot better next time. Thanks!
  8. I need help please, I'm having a difficult time debugging with Rockfrontend, there seems to be some sort of error and it isn't parsing the "content div" So it outputs the default home page content div instead. Since there is no visible error to work with, It makes the bug difficult to find. Also, although I've got Tracy Debugger installed, it isn't visible. I can't seem to see what I'm missing. I'd apprecaite any input and advise please. Thank you so much.
  9. I didn't know where the right place to share this was on the forums, so I'll post it here since it may be helpful to those getting started with ProcessWire hooks, or some experienced ProcessWire developers who might find them useful. Either way, dear reader, If someone already wrote it, why write it again? If you're someone with experience, feedback is welcome! If there are better or more efficient ways to do something, I would love being a student. Some of these may either address challenges that others have experienced as well or were inspired by the awesome community sharing their solutions. Kudos to all of the people out there helping all of us. If someone sees something that was solved elsewhere please share it in the comments to give credit. I have to make a disclaimer- these have worked for me and while most of them are ready to copy/paste, a few of them are going to need customization or tweaking to make them work for your use case. I don't currently have the resources (time) to provide a lot of support. Some of these were slightly rewritten or adapted for the examples. If you run into issues, the best thing to do is research the solution so that you know exactly what is happening in your application. If you adapt something, fix a bug, or address an edge case, it would be great if you can come back and share that. Be smart, if you're going to run hooks that modify or create data, run a DB backup first. This is the part where I say "I'm not responsible if your site blows up". I don't think that's possible, but do the right thing. There are dozens of hooks in the project I am sharing these from, and to manage that I created a file structure to handle this because there were far too many to put in one file and keeping the init.php and ready.php files clean really makes a huge difference in maintainability. Being able to jump between files by filename is a supremely efficient way to work as well. The filenames don't matter, they're there to identify the files and make it easy to locate/switch between them. Here's my approach to directory organization: /site - hooks -- HookUtils -- init -- lazy_cron -- ready init.php ready.php The ready.php file contents: <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); /** @var ProcessWire $wire */ // Import all ready hooks foreach (glob(__DIR__ . '/hooks/ready/*.php') as $hook) { require_once $hook; } The init.php file contents: <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); /** @var ProcessWire $wire */ // Import all init hooks foreach (glob(__DIR__ . '/hooks/init/*.php') as $hook) { require_once $hook; } // Import all LazyCron hooks, import after init hooks as there may be dependencies foreach (glob(__DIR__ . '/hooks/lazy_cron/*.php') as $hook) { require_once $hook; } Operational Hooks Here are some favorites. Sort items in a Repeater matrix when a page is saved This one helped sort RM items by a date subfield to help the user experience when editing pages. This implementation is configured to only fire on a specific template but can be modified to fire everywhere if modified to check that a field exists on the page being saved first. This was adapted from an answer here in the PW forum but can't find the original post, so I'm going to include it. If you're having issues getting items to sort the way you want, check out this post about natural sorting, which also works elsewhere in ProcessWire. Github Gist Automatically add a new child page under a page having a specific template when created This automatically creates a new child page and saves it when a page having a specific template is created. This also has the ability to show a message to the user in the admin when new page(s) have been created by this hook. It is also error safe by catching any potential exceptions which will show an informative error to the admin user and log the exception message. The messaging/logging operation is abstracted to a separate object to allow reuse if creating multiple pages. Github Gist Conditionally show the user a message while editing a page This one shows a message on a page with a specific template under specific conditions. May be page status, field value, type of user, etc. Visual feedback when editing complex pages can be very helpful, especially when an operation may or may not take place depending on factors like the values of multiple fields. This can reduce the amount of explanations needed on each field or training required for users to use a ProcessWire application. In my case, a message is shown if the state of a page indicates that another operation that is triggered by other hooks will or will not run, which is something that the user doesn't directly trigger or may not be aware of. Github Gist Show the user a message when viewing the page tree This is intended to display a message, warning, or error when the page tree is viewed, such as on login, but in this case executes any time the main page tree is viewed to provide consistent communication and awareness. In my case it displays if there is an activity page located under an "Uncategorized" page for an event. This is something that may be buried in the page hierarchy and not noticeable, but if an activity isn't categorized, then is isn't visible on the website, and if it's not visible on the website, people aren't seeing it or buying tickets. So having a persistent message can bring visibility to important but otherwise potentially unnoticed issues. Or you can just say hi and something nice. Github Gist Hook Enhancement - Fast user switching Hooks can run on triggers that vary widely. Some can and should be identified as those that are triggered by the current user, others may be more autonomous like executing via cron. There may be other hooks that are executed by a user that isn't logged in. Depending on the type of action and your need to identify or track it, switching from the current user to another user created specifically to handle certain tasks can be very helpful. ProcessWire tracks a number of things that are attributed to users- log entries note the user, the user that creates pages is stored, the user that last updated the page is stored, etc. You may want to know who did what when, or only take action if the last user that touched something was X and not Y. I created a separate user that has been provided only the specific permissions it needs to complete jobs that are triggered by hooks or crons. Creating a user with less permissions may also help prevent accidental behaviors, or at least help you be very intentional in determining what actions are delegated. Creating custom permissions is also useful. With a dedicated user I can see explicitly that the last update on some pages were made by an autonomous script that syncs information between the ProcessWire application and a third party platform. Github Gist - Fast user switcher Github Gist - Example of switching users in a hook Fast, powerful, and very (very) easy custom admin buttons I needed a way to add custom interactive buttons that had some specific requirements. Needs to be a button that can be clicked by the user and does something Can be conditionally shown to the user with an alternate message if that action is not available Needs to do something on the server and interact with ProcessWire Here's what that looked like for my application. The green "Refresh Activity" button in the top right. That's a custom button and you don't have to author an Inputfield module to get it. When a user clicks that button, it sends a request to the server with GET variables that are recognized in a hook, actions are taken, then a nice message indicating success or failure is shown to the user. To do this you'll need to install FieldtypeRuntimeOnly and create a new field. Following the documentation for that field, create a button with a URL to the current page with GET variables appended. Then create a hook that watches for the specific GET variable that executes if it's present. Shoutout to @Robin S for helping make short work of a potentially complex task. Note that the field code contains JS that handles the URL on page load. Since the hook is looking for a GET variable in the URL, using the back button or refreshing the page will cause the action to run twice. The JS in that example removes the entry from the browser history and also removes the GET parameter after the page loads if it's present. Github Gist - An example gist for the hook that handles the action Github Gist - An example of the FieldtypeRuntimeOnly code that is displayed and interacted with by the user. Automatically convert logged object or array data to JSON If you're using the outstanding Logs JSON Viewer (yet another great one by @Robin S module, then this hook makes for a thoroughly enjoyable logging experience. Using array or stdClass data when logging your values helps store additional information in an organized way Github Gist <?php $log->save('log_name_here', 'Regular string message'); // Remains a string $log->save('log_name_here', ['gets' => 'converted', 'to' => 'json']); $log->save('log_name_here', (object) ['is' => 'stdClass', 'object' => 'friendly']); Use a separate field to store address data for a FieldtypeMapMarker field This one is really simple, more just sharing an implementation and idea, but proved valuable for reducing data redundancy. I have a FieldtypeMapMarker field but the way that I needed to store address data was much better suited to using multiple fields for things like street, city, state, and zip code. I wanted those fields to be the "controlling" fields for the map marker field to prevent needing to edit 2 fields to keep updated, or accidental content diversion between them. On page save the value from the address fields are pulled and converted into a single string that is added to the FieldtypeMapMarker field's "address" property. I used a Custom Field (ProFields) for my address fields but this can be modified to suit your use case very easily. Github Gist You might also consider hiding the address input on the FieldtypeMapMarker field itself to reduce confusion since the values will be updated automatically anyway. You'll need to have this in a file that is appended to the Admin styles /* You can find the appropriate class for the template you are applying this to in the <body> element when editing a page You can omit that if you want to apply this everywhere */ .ProcessPageEdit-template-your_template_name .InputfieldMapMarker.Inputfield_activity_location .InputfieldMapMarkerAddress, .ProcessPageEdit-template-your_template_name .InputfieldMapMarker.Inputfield_activity_location .InputfieldMapMarkerToggle, .ProcessPageEdit-template-your_template_name .InputfieldMapMarker.Inputfield_activity_location .InputfieldMapMarkerLat, .ProcessPageEdit-template-your_template_name .InputfieldMapMarker.Inputfield_activity_location .InputfieldMapMarkerLng { display: none !important; } <?php // Add this to your ready.php file or ready-firing hook to insert the file containing that CSS to your admin. $config->styles->add("/path/to/your/custom/admin/css/file.css"); Not-A-Hook Bonus - Here's code for an interactive Google Map Renders a Google Map using a FieldtypeMapMarker field, a separate address field, Alpine.js, and Tailwind. You'll need a Google Maps API key, a styled map ID from your Google Developer account, and the aforementioned fields. I wrote it using the latest Google Maps API. Saved you some time. You'll probably need to tweak it. I adapted this so if you find a bug please let me know and I'll update the gist. Note- this makes use of the AlpineJS Intersect plugin to improve performance by only loading/initializing the map when a user scrolls close enough to it. If you don't want that, remove the x-intersect directive. If you want to see it in action, you can check it out here. Github Gist Hook Support Class - A static method class to translate a field into all languages automatically If you use the Fluency translation module, this is a class that will help out with translating a field into all languages programmatically. Sharing this here because the next hook uses this as a dependency. I keep this in the HookUtils directory noted in the file structure above. Usage is demonstrated in the next hook. Github Gist Translate all translatable fields using Fluency on page save whether from UI or API. This is useful for instances where you want a page translated automatically and especially helpful when you are creating pages programmatically. This requires the above hook support class, as well as Fluency connected to an API account. Here are things that must be kept in mind. Please read them, the code for the hook, and the code for the support class to ensure that it works to your needs. You should modify Fluency before using this, really. Change the value of CACHE_EXPIRY on line 19 in the TranslationCache file to WireCache::expireNever. Do this to prevent chewing through your API usage from month to month on repeat translations. This will become standard in the next release of Fluency. This is an expensive operation in terms of API usage, which is why you very much should modify the caching behavior. This hook does not make an effort to determine which fields have changed before translating because it doesn't really matter if the translation is already cached. First time translations of pages with a significant amount of fields/content may be slow, like noticeably slower first time page save because this operation is only as fast as the speed of the request/response loop between ProcessWire and the translation API. Later page saves will be much faster thanks to cached translations. This will not attempt to translate empty fields, so those won't cause any delays. This works with multi-language text/textarea/TinyMCE/CKEditor fields, RepeaterMatrix fields, and the newer Custom Fields (ProFields). Other fields haven't been tested, but it's definitely possible to adapt this to those needs. I prefer to target specific templates with hooks, you can add multiple but be mindful of your use case. Consider adding excluded fields to the array in the hook if it makes sense Consider adding a field to enable/disable translations from the UI, a checkbox field or something This hook is probably one of the uglier ones, sorry. If you run out of API usage on your account, you're going to see a big ugly exception error on screen. This is due to Fluency not handling an account overage error properly because the return type was not as expected. Will be fixed in the next version of the module This is one that may be tailored to my PW application, I think it's general enough to use as-is for your project, but testing is definitely required. Read all the code please. Github Gist ProcessWire Object Method & Property Hooks The following are custom methods that add functionality to native ProcessWire objects. Add a getMatrixChildren() method to RepeaterMatrixPage objects RepeaterMatrix fields represent nesting depth as an integer on each RepeaterMatrixPage item. So top level is 0, first nested level is 1, second 2, etc. When looping through RM items, determining nesting requires working with that integer. It works, but adding adding some functionality helps out. This is infinitely nestable, so accessing children, children of children, children of children of children, and so on works. Fun for the whole family. This was inspired by a forum post, another one I can't find... Github Gist <?php // Access nested RepeaterMatrix items as child PageArray objects $page->repeater_matrix_field->first()->getMatrixChildren(); // => PageArray ?> <!-- Assists with rendering nested RM items in templates Sponsors are nested under sponsorship levels in the RM field --> <div> <?php foreach ($page->sponsors as $sponsorshipLevel): ?> <h2><?=$sponsorshipLevel->title?></h2> <?php if ($sponsorshipLevel->getMatrixChildren()->count()): ?> <ul> <?php foreach ($sponsorshipLevel->getMatrixChildren() as $sponsor): ?> <li> <img src="<?=$sponsor->image->url?>" alt="<?=$sponsor->image->description?>"> <?=$sponsor->title?> </li> <?php endforeach ?> </ul> <?php endif ?> <?php endforeach ?> </div> Add a resizeAspectRatio() method to PageImage objects Adds a simple way to quickly resize an image to a specific aspect ratio. Use cases include sizing images for Google Structured Data and formatting images for consistency in image carousels. Could be improved by accepting second argument to specify an image width, but didn't fit my use case. Github Gist <?php $page->image_field->resizeAspectRatio('square')->url; // Alias for 1:1 $page->image_field->resizeAspectRatio('video')->url; // Alias for 16:9 $page->image_field->resizeAspectRatio('17:10')->url; // Arbitrary values accepted Add a responsiveAttributes() method to PageImage objects Adds a very helpful method to generate image variations and accompanying 'srcset' and 'sizes' attributes for any image. Designed to be very flexible and is Tailwind ready. Responsive sizing can be as simple or complex as your needs require. Includes an optional 'mobile' Tailwind breakpoint that matches a custom tailwind.config.js value: screens: { 'mobile': '320px'}. I added this breakpoint largely to further optimize images for small screens. The array of Tailwind breakpoints and size definitions can be edited to suit your specific setup if there are customizations When sizing for Tailwind, the last media query generated will automatically be switched to "min-width" rather than "max-width" to prevent problems arising from restricting widths. Example, you can specify values only for 'sm' and 'md' and the 'md' size will have the media query correctly adjusted so that it applies to all breakpoints above it. Github Gist <-- The responsiveAttributes() returns a renderable attribute string: srcset="{generated values}" sizes="{generated values}" --> <-- Create responsive images with arbitrary width and height at breakpoints --> <img src="<?=$page->image->url?>" <?=$page->image->responsiveAttributes([ [240, 125, '(max-width: 300px)'], [225, 125, '(max-width: 600px)'], [280, 165, '(max-width: 900px)'], [210, 125, '(max-width: 1200px)'], [260, 155, '(min-width: 1500px)'], ])?> width="240" height="125" alt="<?=$page->image->description?>" > <-- Heights can be selectively ommitted by setting the height value to null --> <img src="<?=$page->image->url?>" <?=$page->image->responsiveAttributes([ [240, 125, '(max-width: 300px)'], [225, null, '(max-width: 600px)'], [280, 165, '(max-width: 900px)'], [210, null, '(max-width: 1200px)'], [260, null, '(min-width: 1500px)'], ])?> width="240" height="125" alt="<?=$page->image->description?>" > <-- Create responsive images with only widths at breakpoints --> <img src="<?=$page->image->url?>" <?=page->image->responsiveAttributes([ [240, '(max-width: 300px)'], [225, '(max-width: 600px)'], [280, '(max-width: 900px)'], [210, '(max-width: 1200px)'], [260, '(min-width: 1500px)'], ])?> width="240" height="125" alt="<?=$page->image->description?>" > <-- Create custom sizes matched to Tailwind breakpoints --> <img src="<?=$page->image->url?>" <?=$page->image->responsiveAttributes([ 'mobile' => [240, 125], <!-- Custom tailwind directive --> 'sm' => [225, 125], 'md' => [280, 165], 'lg' => [210, 125], 'xl' => [260, 155], ])?> width="240" height="125" alt="<?=$page->image->description?>" > <!-- Resizes width of image to fit Tailwind breakpoints, useful for full width images such as hero images, doesn't change height. Also accepts 'tw' as an alias for 'tailwind' --> <img src="<?=$page->image->url?>" <?=$heroImage->responsiveAttributes('tailwind')?> width="240" height="125" alt="<?=$page->image->description?>" > Add PHP higher-order function methods to WireArray and WireArray derived objects WireArray objects are incredibly powerful and have tons of utility, but there are situations where I find myself needing to work with plain PHP arrays. I'm a very big fan of PHP's array functions that are efficient and make for clean readable code. I found myself often reaching for $wireArrayThing->getArray() to work with data then using functions like array_map, array_filter, and array_reduce. These return arrays, but could easily be modified to return WireArray objects if that is more helpful. Github Gist <?php // The EventPage page class has a method that determines sold out status from more than one source of data/page fields // which means that it isn't queryable using a ProcessWire selector. This returns a single integer calculated from ticket availability // of all events from non-queryable data. $totalEventsAvailable = $eventPages->reduce( fn ($total, $eventPage) => $count = $eventPage->isActive() ? $total++ : $total, 0 ); // Requires using a page class to determine status reliant on multiple data points not queryable via a selector. Knowing what the event // page is for an activity can't be determined using a selector for activity pages. $displayableActivities = $matches->filterToArray( fn ($activityPage) => $activityPage->eventPage()->isPublic() && $activityPage->isActive() ); // Iterating over each Page in a PageArray and processing data for sorting/ordering before rendering on a search results page // Executed within a page class $results = $pages->mapToArray(function($page) { return (object) [ 'page' => $page, 'summary' => $this->createResultSummary(page: $page, maxLength: 750), 'keywordMatchCount' => $this->getQueryMatchCount(page: $page), ]; }); Add an image orientation method/property to PageImage objects Get the portrait or landscape orientation of a PageImage. Github Gist <?php $page->image->orientation; $page->image->orientation(); Add the ability to get all related pages for Page objects at once Gets all of the related pages to a page at once by both page reference fields and links in fields. Transparently passes native arguments to Page methods for native behavior Github Gist <?php $page->allPageReferences(); $page->allPageReferences(true); // Optionally include all pages regardless of status $page->allPageReferences('your_selector=here', 'field_name'); // Use with native Page::references() and Page::links() arguments Add a saveWithoutHooks() convenience method to Page objects The number of hooks in my most recent project was... a lot. There were many that hooked into the page save event and a lot of operations that happen in the background where pages needed to be modified and saved quietly to prevent clearing ProCache files or excessive DB operations through chained hooks. Being able to use a method to do this rather than passing options felt more deliberate and clear when working across hundreds of files and in critical areas of very expensive operations. This method also accepts page save options, but in a way that hooks will always be disabled even if an option is accidentally passed enabling them. Furthermore, it also accepts a string as the first argument that, if debug mode is enabled, will dump a message to the bar via Tracy. Github Gist <?php // Adding a message can be very helpful during testing, especially when saving a page with/without hooks is conditionally based // where the result of another operation determines how a page is saved $page->saveWithoutHooks('updated event sync data hash, saved without hooks'); $page->saveWithoutHooks(['resetTrackChanges' => true]); $page->saveWithoutHooks('message and options', ['resetTrackChanges' => true]); These are a few that I've used to show some diversity in application. Hooking to ProcessWire events makes it possible to build beyond simple websites and implement truly custom behavior. Hope these may be useful to others. If you have any favorite hooks of your own, have corrections of those I've shared, or improvements, sharing them in the comments would be stellar. Cheers!
  10. @nurkkaMutagen is mostly for macOS users and does not have to be enabled on WSL2. WSL2 is already the preferred environment for Windows users, but if you’re still using traditional Windows this makes a huge difference. Turning on Mutagen doesn’t make sense on Linux or WSL2. Do you have TracyDebugger installed? Take a look if you got logging enabled. In some projects Tracy Logs and Informations take a long time to load (but 30 secs is really too long). Try to disable Tracy and if the load time is still slow. But you mentioned, that after a ddev restart it feels fast again, so Tracy (or the logs) are not the culprit.
  11. When you encounter a bardump output or errors in TracyDebugger, a link typically appears below the message, allowing you to open the file and line where the output occurred, with VSCode as the default editor. However, in a Windows WSL2 environment, this feature doesn’t work by default. To enable these links, add the `editor` and `localRootPath` variables to the TracyDebugger module's config or in your `site/config-dev.php` (or site/config.php). Here’s an example in my config-dev.php that works for me. Make sure to use `vscode://vscode-remote/wsl+nameOfYourDistro/pathToYourFiles/%file:%line`. This establishes a remote connection to the selected Linux distro. $config->tracy = array( 'frontendPanels' => array('mailInterceptor', 'panelSelector'), 'nonToggleablePanels' => array('mailInterceptor', 'tracyToggler'), 'outputMode' => 'DEVELOPMENT', 'forceIsLocal' => true, 'guestForceDevelopmentLocal' => true, 'editor' => 'vscode://vscode-remote/wsl+Ubuntu22.04/home/jmartsch/htdocs/fugamo/fugamo-shop/%file:%line', 'localRootPath' => 'dist/', 'backendPanels' => array( // 'processwireInfo', // 'requestInfo', // 'processwireLogs', // 'tracyLogs', // 'methodsInfo', // 'debugMode', // 'console', 'mailInterceptor', 'panelSelector', 'tracyToggler' ), ); Now you can click on the filename, and get directly to the corresponding line.
  12. Another module that was created through the development of RockCommerce 😎 Ever needed a list of all countries of the world? Wanted to show a subset? Needed to translated them to other languages? Check out RockCountries, which can help you with these things: // using tracy debugger's bd() bd(rockcountries()->countries()->get('alpha2=aut')); Download & Docs: baumrock.com/RockCountries
  13. thank you! unfortunately the result is still the same 😞 do you need another dump from tracy?
  14. Hey @adrian Today @netcarver requested to make RockFrontend's livereload work on tracy error pages - which is something that has been annoying for myself for a long time: https://github.com/baumrock/RockFrontend/issues/25 The problem is I've really tried hard to do so, but I can't find a way to modify the markup of the rendered page ? LiveReload in RockFrontend works simply by having this markup on the page: <script> var LiveReloadUrl = '{$this->wire->config->urls->root}'; var LiveReloadSecret = '$secret'; console.log('Loading LiveReload'); </script> <script src='$src'></script> Any ideas how we can get this working? I even tried using Debugger::$customBodyStr = "TEST"; and similar, but that doesn't seem to do anything at all, though I see you are using it in your module? I'm totally lost here and hope you have a simple solution to finally get rid of these annoying manual reloads on error pages ? Thx in advance! PS: This is actually the same request as this one just with different wording: https://processwire.com/talk/topic/29555-why-is-it-so-complicated-to-add-custom-panels/ I mentioned in that post that I got it working, but I can't find the working version any more of I just thought it was working but it actually didn't... PPS: I'm talking about these pages:
  15. I've done a video about DDEV, but it doesn't go through setting up ddev. Just follow the instructions on the ddev website. For this you need to tell tracy debugger where the files live on your local file system. This is because PW + Tracy run inside the container and inside the container your files live in /var/www/html. So if you click on a debugging link in tracy then your OS tries to find the file /var/www/html/foo.php and obviously can't find it. // tracy config for ddev development $config->tracy = [ 'outputMode' => 'development', 'guestForceDevelopmentLocal' => true, 'forceIsLocal' => true, 'localRootPath' => '/path/to/your/project/', 'numLogEntries' => 100, // for RockMigrations 'editor' => 'cursor://file/%file:%line', ]; The important part for you is the "localRootPath" setting.
  16. Thanks for reply. I installed php-tokenizer extension and now there is another error : ErrorException: Undefined array key "pwFunctions" in /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/includes/PwApiData.php:25 Stack trace: #0 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/includes/PwApiData.php(25): Tracy\Bar->Tracy\{closure}(2, '...', '...', 25) #1 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/TracyDebugger.module.php(3082): TracyPwApiData->getApiData('...') #2 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/ConsolePanel.php(154): TracyDebugger::getApiData('...') #3 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(143): ConsolePanel->getPanel() #4 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(115): Tracy\Bar->renderPanels('') #5 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('...') #6 /usr/local/www/apache24/data/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #7 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(319): Tracy\DevelopmentStrategy->renderBar() #8 [internal function]: Tracy\Debugger::shutdownHandler() #9 {main} My server is on FreeBSD 14, PHP 8.3, MySQL81 pwFunctions should be defined somewhere?
  17. Hi. I have from Tracy some strange error : Error: Call to undefined function token_get_all() in /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/includes/PwApiData.php:337 Stack trace: #0 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/includes/PwApiData.php(118): TracyPwApiData->getFunctionsInFile('...') #1 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/includes/PwApiData.php(25): TracyPwApiData->getProceduralFunctions('...') #2 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/TracyDebugger.module.php(3082): TracyPwApiData->getApiData('...') #3 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/ConsolePanel.php(154): TracyDebugger::getApiData('...') #4 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(143): ConsolePanel->getPanel() #5 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(115): Tracy\Bar->renderPanels('') #6 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('...') #7 /usr/local/www/apache24/data/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #8 /usr/local/www/apache24/data/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(319): Tracy\DevelopmentStrategy->renderBar() #9 [internal function]: Tracy\Debugger::shutdownHandler() #10 {main} How to solve this ? Thanks for answer. Pavel
  18. Hello. I'm trying to track the changes of a textarea field. The field has a TinyMce inputifeld configured and Markup/Html as content type. To track the changes I use this hook in the init.php: wire()->addHookBefore('Pages::saveReady', function($event) { $page = $event->arguments(0); if($page->template->name === 'wiki-page'){ if($page->isChanged('body')){ bd($page->getChanges()); //using Tracy here } } }); The issue is that the isChanged method returns ['body'] even if the body field has not changed, but only when some type of markup is present. For example, if I put some simple formatted text and I save the page, the changes are tracked correctly. But if I put a <table> or a <ol> in the body, when I save the page the isChanged method returns always ['body'], even if I have not changed anything. Am I doing something wrong with the hook? Maybe the saveReady is not the correct place to track changes? Or is this a Processwire issue? I'm using Processwire 3.0.227, the only extra plugins installed are ProcessDatabaseBackups and TracyDebugger, and I'm using php 8.2.4 in a Mamp Pro installation on MacOs. Thank you! Leo
  19. Hi, We use RockMigrations (an older version) to run migrations for our various modules on client sites. We execute the migrations using the Tracy Console, which works for nearly 100 websites. However, intermittently, we encounter a problem when attempting to run scripts in the console. Instead of executing the script, the console either loads the front-end of the website into the output panel or, in one case, even opens the front-end in the current browser window, causing us to leave the CMS. We have attempted to identify the issue: It does not appear to be server-related, as some of these sites run on our own shared server with identical settings (Fast-CGI, PHP 7.3 or 7.4). It does not seem to be related to the ProcessWire version (3.0.240). We have disabled finished.php, init.php, and ready.php with no change. It does not seem to be related to the config files of ProcessWire (which can differ in structure between various versions). We have disabled markup regions to rule them out. We have completely deleted Tracy and reinstalled it. Tracy settings are 'standard', i.e., out of the box. This issue has occurred on installations where the console previously worked, but after an update (both ProcessWire and Tracy), it stopped working. Tracy: 4.26.34 PW: 3.0.240 Notably, on the affected sites, this issue occurs even when running no script (i.e., it’s not the script causing the problem). Could you please provide guidance or a solution to resolve this issue? Thank you for your assistance. Is there any setting that we are missing? Or what else could be the cause of this behavior? It keeps us from updating our moduls, we have to update them manually respectively. Any help/tip is appreciated.
  20. Hi @MarkE - thanks for your hard work on this. It looks like a great start but in my initial testing I am unfortunately seeing some issues. I'd love to see this working reliably and I think #1, #2, and #3 are manageable, but not sure about #4. 1. I think page names need to be page paths because currently children and grandchildren are stored just by name and during an import these could match multiple pages (same name but different branch). 2. If a module stores JSON as one of its config settings, the quote escaping backslashes prevent your regex from matching. An example is my CustomUploadNames module: "ruleData":"[{\"tempDisabled\":0,\"enabledFields\":[\"102\"],\"enabledTemplates\":[\"29\",\"1\"] 3. Single value fields don't seem to work. For example a config settings field like this still returns: "specifiedTemplate":"29" 4. I fear that if you try to support that then you'll also need to be careful about numbers that could be valid template or field IDs. If these are stored as an InputfieldInteger (like I do with Tracy's log line length settings where the default is 100) you'll be OK, but if the module uses an InputfieldText then the quotes will be added to the number and it will possibly match a field and then things will become a mess. Any thoughts?
  21. Hey @adrian this is a small issue but it gets annoying here while working on a new frontend as I see it on every page reload ? This is my layout: The blue border shows where the <body> is. I'm using a dark gray background for <html> and white background for <body> to make sure that the footer (the part where is says "Impressum / Datenschutz TBD" looks like it goes down until the page ends, but actually it ends where the blue line of the body is. This seems to work well, the only problem I see so far is that the tracy debug bar flickers on page load. It seems to be at the bottom of <body> because I tried making the body 100% height and the flash was gone. I also don't see it if I "disable tracy", but I still see it if I only "hide tracy" (the very right icon). Would it be possible to hide tracy until the DOM is loaded or until the final position of the bar has been calculated? Thx in advance! Update: I sometimes see the white stripe even if the bar is disabled! PS: I also tried to change my concept and make the body 100% and then make the body have gray background and make <main> have white bg, but that caused other problems with my layout so I'd prefer a solution that works with html+body ?
  22. I've noticed this a couple of times. I load a page and it crashes, Tracy gives me a big red page with helpful info on it. I then fix the problem, and reload the page - but the error won't go away. For example the screenshot below shows and error saying "Call to undefined function ProcessWore\pappub_inlay_request()", and then highlights a line in my code that (now because it's been fixed) doesn't show the code from the error message! One part of the page is lying to me, and it doesn't go away until some timeout. I'm guessing a cache timeout? But I've tried adding a ?something=123 var and that didn't fix anything either: still received the old error that no longer correlates to the actual code; Tracy seems to be intercepting my actual code to show me the old error! Anyone else had this?
  23. Try this: check the returned value of your datefield check the strtotime value returned don't do anything with your datefield value and just try that convert it manually to a timestamp and try that - just to check try if any of these work: $today = strtotime("today"); $todayDate = date('d.m.Y', $today); $todayDateTime = date('d.m.Y H:i:s', $today); last but not least: check the page data if there is anything in them, make a page dump to Tracy or var_dump() That's how I narrow down issue like this.
  24. Hey @adrian just installed a new pw instance (dev) for testing and got this error: ErrorException: is_file(): open_basedir restriction in effect. File(ProcessWire\BasicPagePage.php) is not within the allowed path(s): (/path/to/user/www:/path/to/user/files:/path/to/user/tmp) in /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php:354 Stack trace: #0 [internal function]: Tracy\Bar->Tracy\{closure}(2, '...', '...', 354) #1 /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php(354): is_file('...') #2 /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php(313): ProcessWire\WireClassLoader->findClassInPaths('...', Array) #3 [internal function]: ProcessWire\WireClassLoader->loadClass('...') #4 /path/to/user/www/tmp/processwire-dev/wire/core/Templates.php(878): class_exists('...') #5 /path/to/user/www/tmp/processwire-dev/wire/core/Template.php(1441): ProcessWire\Templates->getPageClass(Object(ProcessWire\Template), true) #6 /path/to/user/www/tmp/processwire-dev/wire/core/PagesLoader.php(1312): ProcessWire\Template->getPageClass() #7 /path/to/user/www/tmp/processwire-dev/wire/core/PagesLoader.php(521): ProcessWire\PagesLoader->getById(Array, Object(ProcessWire\Template)) #8 /path/to/user/www/tmp/processwire-dev/wire/core/Pages.php(289): ProcessWire\PagesLoader->find('...', Array) #9 /path/to/user/www/tmp/processwire-dev/wire/core/Wire.php(419): ProcessWire\Pages->___find('...', Array) #10 /path/to/user/www/tmp/processwire-dev/wire/core/WireHooks.php(968): ProcessWire\Wire->_callMethod('...', Array) #11 /path/to/user/www/tmp/processwire-dev/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), '...', Array) #12 /path/to/user/www/tmp/processwire-dev/wire/core/Page.php(3968): ProcessWire\Wire->__call('...', Array) #13 /path/to/user/www/tmp/processwire-dev/wire/core/PageTraversal.php(132): ProcessWire\Page->_pages('...', '...', Array) #14 /path/to/user/www/tmp/processwire-dev/wire/core/PageTraversal.php(157): ProcessWire\PageTraversal->children(Object(ProcessWire\HomePage), '...', Array) #15 /path/to/user/www/tmp/processwire-dev/wire/core/Page.php(1883): ProcessWire\PageTraversal->child(Object(ProcessWire\HomePage), '...', Array) #16 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(484): ProcessWire\Page->child('...') #17 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(143): RequestInfoPanel->getPanel() #18 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(115): Tracy\Bar->renderPanels('') #19 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('...') #20 /path/to/user/www/tmp/processwire-dev/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #21 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(319): Tracy\DevelopmentStrategy->renderBar() #22 [internal function]: Tracy\Debugger::shutdownHandler() #23 {main} Tracy was installed some seconds before, so it should be the latest version ?
  25. Hey @adrian I'm using ProcessPageList() to render a pagelist in my custom process module. I wondered why I only get bd() calls in the debug bar for ajax requests when collapsing a tree item, but not for the very first one. This is my code: <div id='pageviews'></div> <script> $('#pageviews').ProcessPageList({ rootPageID: 1, showRootPage: true, ajaxParams: {'rockcounter': true}, }); </script> I then tried wrapping that code in setTimeout() with a delay of 1000ms and then I got the bd() calls also for the very first request. Is there any recommended way of dealing with this? I tried to wait for dom ready, but that seems to be too early and tracy didn't catch the first request. On my laptop it works with a delay of 100ms, but in other setups it might be different, so I'm wondering if there is a solid way of waiting for tracy to capture the ajax call?
×
×
  • Create New...