Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/27/2023 in all areas

  1. First of all, there are other benefits than performance — such as the fancy process view that SessionHandlerDB comes with (if I recall correctly, it's been a long time since I've tried it). Also if you have multiple servers but shared database, it may be easier to use DB sessions. (We use Redis in part for this reason.) I don't have any numbers, and I'm afraid those wouldn't be very helpful. Performance depends on a number of factors and thus numbers from one use case may not be applicable to another. That being said, in my personal experience for typical use cases disk is often faster and has smaller chance of running into scalability issues; I've never had scalability issues with disk based sessions, but I've run into them multiple times using database sessions. Though again, that's just my experience from the setups and use cases I've worked with ? Overall, comparing session files stored on local disk vs. MySQL/MariaDB that stores data on the same disk, I would expect database to have more overhead; it has to do much more than just read a file from the disk, after all. But then again database can make use of in-memory caching to mitigate such issues. And of course if your database is on a separate machine (or a faster disk) that would again change things, though that's also where latency due to connections and data transfer may step into the picture. Finally, the native PHP session handling mechanism is in some ways less likely to cause issues, especially compared to something you've cooked up yourself. (Just for the record, PHP has built-in support for storing sessions in Redis, so I would consider that "native"). It should probably be noted, though, that if you let PHP handle garbage cleaning, that is likely to cause some amount of overhead; the approach that Ubuntu takes (separate cron job) does not suffer from this, at least not in the same way. My personal preference for session storage is Redis — which, again in my experience, is also the fastest option of those mentioned here — and if that's not available then disk ?
    3 points
  2. Just wondering if it might be related to this: https://github.com/processwire/processwire-issues/issues/1760. Basically on some systems (mainly Ubuntu) sessions are cleared in a somewhat non-standard way, which works for disk based sessions but not work SessionHandlerDB. Site running slow could mean that the sessions table has grown so large that queries take very long time. If that's the case, you may want to apply the solution that Bernhard suggested in aforementioned issue. Or alternatively disable SessionHandlerDB. (Just for the record: in most cases I would advise against database sessions, unless there's a specific reason for them. Disk is usually — in my experience at least — faster and also tends to have fewer quirks. If disk based session storage is not an option, I would look into setting up Redis for session storage.)
    3 points
  3. Hello, I'm back ... I spent a week of full immersion at work. I fixed the installation error (and pulled a request on GitHub). It was a bad condition in a public function. Sorry, I had missed it. P.S. Please, check your part of read.me (more or less, at line 14) ```<?php echo buildGoogleTranslateUrl('es');?>``` Do you mean calling the function from the module as: ```<?php echo $translate->buildGoogleTranslateUrl('es');?>```
    2 points
  4. @Nishant happy to hear you have your site up and running again. Out of interest, and to help try and track this down... what version of the SessionDBHandler module were you running (if you happen to know?) are you using the MyISAM or InnoDB engine in your MySQL/MariaDB installation?
    2 points
  5. Ok, it just required a small tweak to the regex that finds the H1 element in the support files (it adds them to that page) and demotes the H1s to styled H2s. In ProField's case, the H1 is not the first line of the readme file - something I was never expecting - so we ended up with multiple H1s in the DOM, with associated styling confusion. Version 0.11.3 should fix it for you.
    2 points
  6. Oops, I'll do it again: I'll present DDEV at the next PHP Meetup Vienna in August! Also I'll record the talk so that everybody here that is not yet using DDEV can watch it on my youtube channel to get a quick impression. The title is already found thx to the help of chatgpt ? Now I ask for your input what you love about DDEV, what problems it solves for you and what you like most about it. And maybe also what you didn't like on other systems that you've used before. Where do you think does it stand out from the crowd? What does it do similar to other available options? What are those options (just to get a birds eye view)? ... I'll let the first words up to you ? Thx for your input and help ? MEMO https://processwire.com/talk/topic/27433-using-ddev-for-local-processwire-development-tips-tricks/?do=findComment&comment=234217 ngrok for mollie webhooks chatgpt poppler-utils aliases endless loop -> ddr custom docroot
    1 point
  7. I was in New Orleans at the gymnastics Nationals most of this week. In her age group and level, my 10-year old daughter won 4th overall and 3rd on bars and beam. After a long drive, we're now back home in Atlanta and it's been a very short work week, but there's still a new dev branch version to write about. ProcessWire 3.0.221 continues primarily with minor issue fixes, working towards our next main/master version. Included are 11 resolved issues, 2 PRs, and code contributions from @matjazp and @dotnetic. In terms of new features, this version updates the language translating _n() function to support languages that consider 0 quantities as singular rather than plural in calls like _n('%d item', '%d items', $quantity); Previously this call has always used the plural "items" version for 0 quantities (i.e. "0 items"), which is correct in English, but may not be in other languages like French (as I've learned from issue #1757, though I think it has come up once before too). To define whether a language should consider 0 quantities plural or singular, use ProcessWire's language translation tool: Setup > Languages > [any language] > Find files to translate > wire/modules/LanguageSupport/LanguageTranslator.php ... when translating that file, you'll see the setting at the top labeled "Is zero (0) plural or singular?": That screenshot above also shows another new feature that was added, which is the ability to use Select and Radios fields when defining translatable text. Previously you could only use text, textarea and number fields. Let's say you wanted to have the person translating choose a color name for the language as part of the translation: $color = __('Red'); // What color? type=radios options=[Red, Green, Blue] As before, the "What color?" part is an optional description for the translatable text. Also as before, the "type=..." defines what Inputfield type to use. The supported values are any Inputfield name (minus the "Inputfield" part). Known to work values for this include: text, textarea, integer, float, radios and select. The "options=[...]" is the newly added part, and this enables you to define the selectable options for select or radios inputs. If you wanted to use separate value and label, you can also do that. In the example below, city abbreviations are used for the values and full city names as the labels: $city = __('ATL'); // What city? type=radios options=[ATL:Atlanta, CHI=Chicago, NYC:New York City] Another example is the one we used in the core for plural vs. singular here. By the way, if any of your values or labels need a literal comma, you can optionally use a pipe "|" as the separator rather than a comma. This ability to use Select and Radios is a fairly minor addition, but does open up better support for having certain language settings (rather than just translatable text) be part of language translation packs going forward. The plural vs singular setting for 0 seemed like a good first one to support with this. Next week we'll continue preparing our next main/master version. Thanks for reading and have a great weekend!
    1 point
  8. I created a simple translation module for a project we're currently working on and I thought I would share it in case it's useful for anyone else as it's a request we've come across a few times recently. It's a basic page translation module using Google Translate to replace their now retired embeddable page translation widget. The module outputs a simple, un-styled, dropdown language selector that routes the visitor to a translated version of the current page via translate.google.com. From there you can then navigate the whole site in the your language of choice. There's also a method to output a single language-specific translation URL for any supported language using the language ISO code. Download, usage and supported language list available on my Github here: https://github.com/mrjcgoodwin/MarkupGoogleTranslate Caveat 1: Google seem to be trying to encourage use of their Google Translation API, so the continued working of this module is completely at their mercy - I can imagine they may discourage this usage at some point, but who knows! Caveat 2: I haven't yet deciphered what all the parameters are used for in the constructed Google Translate URL. It's possible there may be some sites/scenarios where the URL doesn't work. Feel free to report if you find any issues.
    1 point
  9. Hi @alexm, Exactly. An example: <?php namespace ProcessWire; public function setAddonPage(Page $page, string $addonSettingsFieldName) { // here we assign these variables to class properties for convenience // you don't have to do that // you can use $page directly to get your settings using 'addonSettingsFieldName' $this->addonPage = $page; $this->addonSettingsFieldName = $addonSettingsFieldName; // -------- // EXAMPLE $addonSettingsJSON = $page->get($addonSettingsFieldName); bd($addonSettingsJSON, __METHOD__ . ': $addonSettingsJSON at line #' . __LINE__); if(!empty($addonSettingsJSON)){ $addonSettingsArray = json_decode($addonSettingsJSON,true); // do something with $addonSettingsArray } } I thought I had a hello world addon example in the demo projects. Looks like I don't. I'll add that to my TODO.
    1 point
  10. This is interesting. I thought it would be the other way round. Thought that ryan wrote that somewhere and also thought that as SessionHandlerDB is newer it has a reason that it has been built and would therefore be preferable over disk sessions. Do you have any more insights/references about your statement? Maybe I should switch ?
    1 point
  11. I have been using $page->sort settings to try to migrate consistent page arrangements and all has gone well except I can't seem to alter the sort arrangement of the error page. I know it is a reserved page. I can alter the sort order between the various reserved pages but I cannot get it to appear higher. The strange thing is that I can set the sort number and if I try to find all pages off of the root page and and sort them by sort: $list = $this->wire->pages->find("parent=1,sort=sort",["include"=>"all"]); and then db($list) the error page does appear properly sorted in the array that results: But in the Pages menu, it remains lower: Are reserved status pages special in this regard?
    1 point
  12. Yes, certain system pages are forced to the bottom of the list. See ProcessPageListRenderJSON.php
    1 point
  13. Good evening @kongondo, just a quick one (hopefully). Sorry in advance, I'm not much cop with module development etc. I'm just wondering how I access the addon page and 'padloper_settings' field name from the TestAddon class. I note the setAddonPage() method in the custom addon docs but not sure/understanding entirely it's purpose or if this is used to retrieve them? But effectively I've created a method saveConfigurations() which gets passed the fields array and JSON encoded ready to save to the 'padloper_settings' field. Now I just need to figure accessing the page object and field name in the right manner rather than hard coding. Thank you in advance for any assistance as always.
    1 point
  14. Ok weirdest vibe!! I've just received 2 emails for orders (2 new live orders) with the above code and no changes. One being a stripe payment and one being a paypal payment. I wonder whether that narrows it down to me using Invoice payment as the option. Either way, it's working as expected. How very very bizarre!!
    1 point
  15. Haha, yeah, poor form on my part for not being at all descriptive. Sorry! ✅ The hook is called for sure I'm uncertain as to the rest. If I do a bar dump on $sent = $mail->send(); I get 1 as the response. I don't know whether this would be the expected response mind and there is definitely no email being received. So somewhere around this point there seems to be a potential issue. I'm receiving emails from the email address being set as the from address in other parts of the code which utilises wireMail(), which is why I thought perhaps my hook's function wasn't quite set up right. Though it seems like it should be to me...
    1 point
  16. To use background images I use the following plugins: 1. Lazysizes: https://github.com/aFarkas/lazysizes 2. The Lazysizes bgset extension: https://github.com/aFarkas/lazysizes/tree/gh-pages/plugins/bgset Note: The bgset extension must be loaded before the Lazysizes plugin. That's why I disabled the "Use Lazy Loading" in the module settings and load both files above manually in the correct order. To make use of a background image this code here works for me: <div class="img-title-wrapper lazyload" data-sizes="auto" data-bgset="<?php echo $image->size($imgFormat)->srcset() ?>"> /* your content */ </div>
    1 point
  17. I think u can solve it with this module https://processwire.com/modules/custom-inputfield-dependencies/
    1 point
  18. $languages does not return languages in the order as they're in the tree. But you could get language yourself since language is a page with template "language"... and add a sort=sort. $allLangs = $pages->find("template=language, include=all, sort=sort");
    1 point
  19. You can hook before Fieldgroups::save or Templates::save. public function init() { $fieldgroups->addHookBefore('Fieldgroups::save', $this, 'addProcessField'); } public function addProcessField(HookEvent $event) { $fieldgroup = $event->arguments[0]; if(!$fieldgroup->hasField('process')) $fieldgroup->add('process'); }
    1 point
×
×
  • Create New...