Jump to content

da²

Members
  • Posts

    376
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by da²

  1. Are you observing abnormal RAM usage before the crash? For the past few months, we've been experiencing an issue on a server that hosts several websites. MariaDB has been using more and more memory, and after a few weeks, it reaches the server's limit of 8 GB, causing the Linux kernel to kill processes. This issue started around the same time I installed a new site built with ProcessWire, but I can't say for sure that it's related. We've checked our MariaDB settings, the opened connections status, investigated what we could, but we haven't found the cause yet.
  2. What is disturbing me the most is the fact that I'm not finding pages (using Pages API) that are not enabled for the current user language. For example, I have a few templates that are not meant to be translated, so I disabled multi-language management ("Settings tab" in the template). But if user is not using the default language I don't find them. pages()->find('template=foo'); // Need all pages even if not enabled for current user language In Page Names module option, we can avoid the page to show a 404 and make it render in default language, but it's missing the same option using API to find pages (find(), children()...). I see 2 workarounds, not really satisfying: Always enable all languages on every page and template, even if they are not meant to be translated. Set user language to default before every kind of page search. This is too much, and error prone. A global option would be better. Maybe I'm missing another option?
  3. Just to add to this topic, Page class has a function to enable language, a bit cleaner than using "status$lang": foreach (languages()->findNonDefault() as $language) { $page->setLanguageStatus($language, true); }
  4. Thanks, I find this behavior a bit odd and think the option implemented in RockMigrations could be on the core module "Page Names". Creating pages via API doesn't use the same behavior as when using the admin interface, or even when generating pages within an admin hook (all languages are activated by default in these cases). I don't understand why this is different in a hook and when bootstrapping PW. Also, when we add a new language, every existing page is automatically enabled for this language, so why not doing it by default when a new page is created on front-end? Do you know the reasons behind these choices?
  5. Hello, My site (PW 3.0.240), using multi-language URLs since a few months, has default language french, and another language english. I don't know why, but a specific template is not accessible to english on front-end: If I go to the english URL of one of these pages, I get a 404. If I go to one of this pages in french, the language switcher shows only french as available language. If I display the pages of this template while using english, I get an empty list. I found that I checked in "template > advanced" the option "Disable multi-language support for this template" but: Enabling it again doesn't solve the issue. This option doesn't show a 404, it just switch language to default when loading this page. That was a mistake to check it, but not the cause of this issue (apparently). While writing this post, I investigated more and found the following. I finally found what makes these pages unreachable in english, this in the pages themselves, this checkbox is disabled in Settings tab: These pages are created dynamically, why is this "active" checkbox disabled, is it expected, and how to enable it automatically? This is more serious than it looks, because it ends with important bugs in the site and database inconsistencies. The problematic template represents a team in a competition. When a user using english language registers to a championship and creates a team, it is well created, BUT when he leaves the championship the team is not deleted because the find() method is not returning it, and the user is still referenced in the team even if not in this championship anymore. I'm disabling english to avoid more damages until I can fix this properly. How can I fix this? And if you have informations about this behavior, please explain or give documentation links, I'm a bit lost actually.
  6. Create 2 dates, one on the first day of the month, one on the last day, and use the selector "event_date>=begin, event_date<end". You are potentially loading thousands of pages here.
  7. Check that the root directory configured in your web server is the same than previous. The path before that has no importance. And obviously, don't use absolute paths in your code, but that shouldn't be the case. Also maybe check if your less compiler has an option to delete its cache, or a cache directory that is set to an absolute path maybe?...
  8. languages() global function is another way to get the instance, but wire()->languages property should work too.
  9. Hello, You can use $this->languages, wire()->languages or wire('languages'). I prefer to use wire()->languages so PhpStorm knows what I'm using.
  10. If trying to migrate an existing site from one server to another, the easiest is to copy files and replicate the database. No need to use the PW installer. Then, if wanted, you can update PW to the last version using the official module ProcessWireUpgrade.
  11. Both codes are NOT giving the same selector, you could check by printing it. First case gives: "item_number= " (with a space) Second one gives: "item_number=' '" (space inside quotes) To find empty values, you can just use "item_number=''" (no space inside quotes), or "item_number=" (nothing after equal). But I don't know why the first one is returning a page with item_number=50032. If you're sure everything is right on your side, maybe report a bug on Github.
  12. Hello, Are you using Apache? Is it configured to read .htaccess files? Is mod_rewrite enabled? https://gcore.com/learning/how-enable-apache-mod-rewrite/
  13. I won't help for reading a function name. 😆 I don't know the module, check the documentation.
  14. Question is: will the Javascript be aware of the changes on the field? I bet no, and that it will need to be reloaded. I confirm that, I had to remove these conditions on a page because it was totally bugged (3 or 4 fields with dependencies), reported the issue but nothing has been done. 😐
  15. Hi, My first though is about .htaccess. Is it the original one? Does the web server process it correctly and does the server have more rules (redirections...) that could interfere with the PW .htaccess rules? Could it be related with the 404 page configuration in config? $config->http404PageID = 27; Also check that no hook is doing that redirection, like a hook that would say: "redirect normal and guest user to home page if they try to access admin"? ^^
  16. Yes, you can do it by changing the parent page template sorting option. The child template doesn't change, only the sort option on parent page template. /blog/ sorts children: most recent first /events/ sorts children: date order ascending
  17. Hi, You don't need a hook, you can sort children on the parent page:
  18. If you have a search page that allows to search text in a lot of pages containing big texts, you probably need it. Do a performance benchmark with and without. Yes but without the mistake you did on the method name. 😁
  19. I didn't play with multilanguage image fields, but if it's the same behavior than with other multilanguage fields (probably) you have nothing to do: if a multilanguage field defines a value for the current user language, then this value is used, otherwise the default language value is used. EDIT : hmm, looks like there's no multilanguage image field, so language alternate fields looks like the only solution, and then a hook like @ngrmm proposed sounds good.
  20. Hi, In my experience we did that with project management softwares like Redmine, or Jira for a paid solution. You create user stories, tasks, estimate time and so on...
  21. Solution is here: https://processwire.com/modules/search-engine/ // Alternatively index just a single page (passing in a Page object): $modules->get('SearchEngine')->indexPage($page);
  22. On my side I backup DB only manually (I run a mysqldump script), I never want an automatic dump because it may backup a database in a dirty state. My goal is to keep a clean version of DB that could be installed on a fresh server.
  23. Hi, First thing I see is you are trying to display too much pagination. Ten elements is usually enough, with 3 dots in the middle: 1 2 3 4 ... 9992 9993 9994 9995. But then there's no really interest in displaying years. ^^ I bet the problem is only a design question: what kind of data do you want to display to the user? Is is truly ergonomic to display an infinite line of links? Wouldn't it be better to display only years at first, then when user clicks a year, display the pagination? Maybe think about it and you'll find a solution better for user and the developer. 🙂 Anyway, the solution will be a good designed MySQL query, but never to load "all" data.
  24. You are indexing all the site pages every time a page is saved. You should index only this page since the work for other ones was already done.
×
×
  • Create New...