Jump to content

netcarver

PW-Moderators
  • Posts

    1,981
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by netcarver

  1. @bernhard I use redis alongside PW on some client sites (using php-resque for background jobs like email composition and send) - though I do not use this particular module in production yet. I think bitpoet is aiming for an API-compatible drop-in for wirecache that leverages the lower latency of redis' in-memory accesses.
  2. Is anyone out there working on a Crowdsec bouncer integration for ProcessWire? I know there's an official module for WP - but wonder if anyone has considered, or is currently working on, a port or native version for PW?
  3. @valan You can use PWGeeks to search for docker-related PW stuff. Try this for starters: https://pwgeeks.com/?q=docker
  4. So it is ublock-origin. Thank you for the pointer - I should have checked that first! Updated to add 1: I actually run UBO in all my browsers so there must be a settings difference between UBO in my FF and Brave installs - will look into it. Updated to add 2: Found it in case anyone else is interested. There's an entry in the UBO blocklist called "Fanboy's Annoyance" for .privacywire-wrapper that is causing the issue. I had this list enabled in FF but not in chrome.
  5. @ngrmm Thank you for the quick reply. So I have the checking of DNT set off in the module settings, which should make it ignore the browsers DNT setting (I think). I'll look at other browser/extension settings as I do run ublock origin.
  6. Has anyone noticed any issues getting this module working in FF? It seems to work fine in Chrome based browsers but in FF for me - no errors in the console either which seems strange.
  7. @cpx3 Were you able to revert to the previous installed version to restore your site's operation? Also, if you look in site/assets/logs for the latest entries in the error.txt and exceptions.txt files, you may get a better picture of what's going on - and if you are running PHP with error logging turned on you can look in the PHP logs too. The exact location of these files (and if they are even used) will depend on your php.ini file.
  8. @Zeka Thank you, I will give that a try as well. Updated to add: Yes! Using boot.php works nicely, I can now stick with PWs own autoload mechanism, thank you for the suggestion.
  9. Update: I can get the trait composition to work by adding a psr-4 clause to the autoload part of the root composer.json and then running composer dump-autoload from the command line. Not ideal, but seems to be the only way I can get the autoload information in to PW in time for it to use it when creating the UserPage class.
  10. Thanks for the reply, @thetuningspoon I did try extending the autoloader in init.php instead of ready.php but it seemed to make no difference. The only thing that seemed to work for me was a direct include of the trait file from within site/classes/UserPage.php. Will try again though in case I did something wrong first attempt. No, still getting that error when it comes to autoloading for UserPage regardless of the location of the extension to the autoload mechanism. Actually, that might work fairly well in this case, though I'd really like to be able to get to the bottom of the autoloading.
  11. Hello, I'm starting to play catch-up with some of the recently (and not-so-recently) added features to PW. In particular, I'd like to ask about more complex uses of Page Classes. I have a site where the end users are actual PW Users with first and last name fields. I also have several other templates in the system that have the first and last name fields but they are not actually Users of the system, rather they are entities like Contacts or other personages that can be also be named. I thought I'd enable page classes and add a simple getName() method to the UserPage class to allow their name fields to be nicely concatenated. In itself, no problem, as long as I remember to extend from User. So here's exhibit A: UserPage.php... <?php namespace ProcessWire; class UserPage extends User { function getName() { return trim($this->first_name . ' ' . $this->last_name); } } This works fine, I can call getName() on my users, nice. Now, my other nameable entities need this function too. I can extend from UserPage to inherit the getName() function, which works well and is straightforward... <?php namespace ProcessWire; class ContactPage extends UserPage { } So I can now use $contact->getName() as well as $user->getName(). But, my contacts aren't really system users, so I'd prefer not to inherit from UserPage at all, but either inherit from some intermediate class representing some form of NameableEntity or else use traits to compose the functionality into the individual page classes which need it. However, I'm hitting snags with both approaches and would appreciate some feedback. Attempt at Traits So I add the following as site/classes/NameHandlingTrait.php... <?php namespace ProcessWire; trait NameHandlingTrait { public function getName() { return trim($this->first_name . ' ' . $this->last_name); } } And switch my ContactPage.php over to using it... <?php namespace ProcessWire; class ContactPage extends Page { use NameHandlingTrait; } And that works. I can access $contact->getName(); (I actually did it by setting up the wire autoloader in ready.php to look for a specific namespace in a traits/ subdirectory - but I'll skip showing that here, it did work for my page classes that extend from Page.) However, when I try switching UserPage.php over to the same trait code to keep it DRY... <?php namespace ProcessWire; class UserPage extends User { use NameHandlingTrait; } I immediately hit the following error: "Fatal Error: Trait 'NameHandlingTrait' not found (line 5 of /site/classes/UserPage.php)" either when visiting the site (front end or admin) or by bootstrapping from the CLI. I can overcome this by manually requiring/including the trait file at the start of UserPage.php - but I'd much rather autoload it if at all possible. No matter how early I try to declare the extension of the class loader to attempt to autoload the trait, it isn't soon enough and I always hit the fatal error shown above. Can anyone shed any light on this? How do you go about using the PageClasses, especially UserPage, when the structure might need to take more of a composition-rather-than-inheritance form? Also, if you have any suggestions as to other places to get autoloading set up in PW prior to init.php or ready.php I'm all ears. I tried setting up the autoloader mappings in both places and they work for classes derived from Page but not for UserPage - so I suspect PW is creating a User instance pretty early on in its bootstrap, well before it is loading in extensions to the autoloader. I'll try adding a PSR-4 clause to composer.json and dumping the composer autoloader next - but I'd rather stick with native PW autoloading if possible. Intermediate Base Class The other approach I've tried is to use an intermediate base class to house the getName() function and inherit from that. This is doable for the classes derived from Pages but again, I hit the snag that the UserPage seems to have to extend User, and not my base class. @ryan What would you recommend here? Could UserPage extend something other than User?
  12. @fruid Not 100% sure what's going on, but running grep in the site/modules/wireMailSmtp/ folder shows it's using mcrypt functions on lines 67, 68 and 79 of smtp_classes/ntlm_sasl_client.php - but mcrypt was removed from PHP7.2. It might be that @wbmnfktr isn't running into the issue if his setup is connecting to an smtp server without using ntlm_sasl. Is the SMTP server you are connecting to using Windows by any chance? (This might be a wild-hunch) Looks like that file was originally part of PHPMailer - and there are some posts about fixing it to work with NTLM that are more recent. Like this one: https://cheesefather.com/2017/06/phpmailer-ntlm-ms-exchange-smtp-authentication/ (though for a different hash() issue). You might be able to use that to patch your local copy - or otherwise look for a more recent version of the ntlm_sasl_client class.
  13. Hi Adrian, Is it possible to extend Tracy's definition of local host in some way? I'm running my sites out of docker containers on my local machine and can't get it to force guest users into development mode - probably because of the internal IP address assignments to the docker bridge networks. When I visit my site from the browser on my host, the visit has an IP address in the 172.16.x.y range. I'd like to be able to force guests into development mode for a specific visiting IP or block if that's possible. May be something in the settings for this already that I've missed. Regards, Steve
  14. Easy to hit a key combo to go to the end once in the editor. I'd axe the line number from the link.
  15. @teppo Maybe Soma's LogMaintenance module would be useful?
  16. Is your website built using ProcessWire?
  17. You're misquoting me, @bernhard :) Could you try this... <script> var evtSource = new EventSource("sse.php") evtSource.addEventListener('ping', function(event) { var data = JSON.parse(event.data) console.log(data) }, false) </script>
  18. Nice, are you using mermaid-js for the diagramming?
  19. Hi @3fingers Right, so the demo video I posted did this using a few separate parts. An event generator wrote messages into a Redis pubsub channel, and I had a long-running ReactPHP process subscribed to the channel which would then take those events from Redis and send them via SSE to any connected listeners. A little custom JS in the website's home page would connect via SSE to the server and would be asynchronously invoked when an SSE message came in. The JS was really simple, it parsed the incoming SSE message to grab an html id and the new content for that part of the DOM and then do the change (along with a little CSS styling to highlight the swap.) The most difficult part was running the ReactPHP process. In your case, you could replace the back end event generator with a hook and just publish a change when the PW admin control is changed. Anyone connected would then have their screen updated immediately. PM me if you want to discuss directly.
  20. @ryan As a possible alternative to having something polling for changes, have you considered some kind of server side push technology for signalling changes to the connected browsers as mentioned above by @Ivan Gretsky? I've been playing with using a thin ReactPHP layer that sends DOM mutation messages to clients using SSE (which has really good support in browsers) and have about 20 lines of vanilla JS in the browser that does the element replace in the DOM when it gets a message over SSE (though htmx could be used for this too). None of the connections in the video are polling. nifty-reactivedash-demo.mp4
  21. Anyone seeing issues with the generated thumbnail for vimeo-based embedded videos? Currently just getting a stripy image back from vimeo no matter what video is embedded. Pressing play works - the video is streamed and played without issue, it's just the thumbnail from vimeo that's the problem. Looks like this...
  22. Have been using porkbun.com for years. Just for registrations; my DNS and hosting is elsewhere. Porkbun cover .uk, .org.uk and .co.uk domains as well as all the usual suspects.
  23. Nice, thank you Robin. Seems to work well.
×
×
  • Create New...