Jump to content

Guy Verville

Members
  • Posts

    204
  • Joined

  • Last visited

Everything posted by Guy Verville

  1. Hi @horst I don't know if you are aware, but the module will generate a warning with PHP7.3.
  2. Hi Teppo, Thank you very much for your great work! I wonder if it would be possible to prevent a user to be logged. Let me explain, one of our sites has a synchronisation process which use a user 'synchro'. This automated process does not need to be logged, since there are a lot of changes made by this process. We only want to log 'regular administrative' users. I suppose I can hook myself over your own hook, but I am not sure how to proceed. I would like to something like: if (thisUser or theseUsers) don't log.
  3. I have perhaps a beginning of an answer. Using Tracy debugger, I checked three times the file object in the $page, before making the changes, after making the changes, and after having saved the page. The $page object changed after the save. The image file is now in an array... The first, being read before change anything. The second, the changes have been set. The image object is the same. I apply the changes. Boom! While the formatted value should not interfere here, since the output formatting is off there is perhaps something to look here... On my log, I wrote the filename before and after the save. The second name does not show if I call with $page->sku_image->basename. I have to drop the ->base name part. But this does not explain why the image entry disappear. if ($existingPage->template->name = "sku-ceramic") { $image = $existingPage->sku_image->basename; } $this->savePage($existingPage,true); if ($existingPage->template->name = "sku-ceramic") { $this->wire('log')->save('centura-synchro-images', $existingPage->id . "|". $image . "|". $existingPage->sku_image); }
  4. Hi, the CSV file is the same, and this field is not involved. The CSV file contains essentially basic data such as sku name, prices for different regions. The price is the data that changes from time to time. The image is not a field in this CSV file. I made my test on that file and everything operates normally. This is when the $page is saved that something is lost. So my next step is to stop the process and see what's inside the object.
  5. No, p21fields are the reference to csv file we read daily. "sku_image" is an image that must be treated manually. I queried about the hooks, but nothing relevant here, certainly not around the image. My programmer colleague suggested me to desactivate the processChangeLog module which was installed recently, which track changes. But I doubt that it can cause problems. And this table is so simple...
  6. Hi BitPoet, No, the script load the actual page object and processes it. if($existingPage = $this->pageExists($query = 'name=' . $itemSku)) { $extractedData = ""; // we compare the previous json data from the page with the actual jsonEncoded csv line if($existingPage->p21_json != '') { $extractedData = $existingPage->p21_json; } ... //These are two strings to compare $equal = $this->comparePage($extractedData, json_encode($data)); if($equal) { ... no change made return false } // there is difference, so we populate the page with the new data. // image field and other fields are not affected by $data // the function "prepareData" uses $existingPage->set($field, $data [XX]); $existingPage = $this->prepareData($existingPage, $data); ... $this->savePage($existingPage,true); return true; } protected function savePage(Page $page, $reportErrors = true) { try { $page->of(false); $page->save(); $this->wire('log')->save('centura-synchro', $page->title); } catch(Exception $e) { if($reportErrors) { $this->error($e->getMessage()); $this->wire('log')->save('centura-synchro-errors', $page->title . "=> " . $e->getMessage()); } } return $page; } protected function prepareData($p, $data = null) { $fields = $this->generalTools->p21fields; ... foreach($fields as $field) { ... $p->set($field, $data[$ctn]); ... } $p->p21_json = json_encode($data); ... return $p; } public function pageExists(string $query) { $page = $this->pages->get($query); if($page->id === 0) { // page do not exist return false; } return $page; }
  7. We have a script that synchronizes data from a CSV file on a daily basis. The data that is synchronized all belong to a page type. However, not all data of this type of template is inspected. For example, we have a field called "sku_image" that is manually filled in by the administrator. When there is data to synchronize, the script modifies the relevant fields, then saves the page with the help of a function: protected function savePage(Page $page, $reportErrors = true) { try { $page->setOutputFormatting(false); $page->save(); $page->setOutputFormatting(true); $this->wire('log')->save('centura-synchro', $page->title); } catch(Exception $e) { if($reportErrors) { $this->error($e->getMessage()); $this->wire('log')->save('centura-synchro-errors', $page->title . "=> " . $e->getMessage()); } } return $page; However, for some time now, and we don't know why, the entries in the "sku image" field for saved pages have been systematically deleted from the "field_sku_image" table! The image files remain in each folder, but the reference in the table disappears. The field is a very standard image field and is not processed during synchronization except that when the page object is saved. The other data that is not processed in the synchronization remains in place. It is as if the variable $page forgot the data it is supposed to contain. It's a great mystery. Synchronization is performed with a special "user" who has editing rights for these pages. What could cause such behaviour?
  8. Hi, ProcessWire has excellent functionality when it comes to solving URLs in another language. For example, suppose I have the following addresses: domain.com/en/career and domain/fr/carriere. If a user types domain.com/carriere, ProcessWire will be able to deduce that the correct address is domain.com/fr/carriere. On my machine, I can switch between Apache and nginx and the expected behavior works very well with Apache, but not with nginx which will systematically send me back /en/career. I tried to study the ProcessWire code, including the getPage() function and the LanguageSupportPageNames module, but I can't find where it fails. All I perceive is that the user's language does not switch, it remains in English. I would like to point out that otherwise, ProcessWire works smoothly with nginx.
  9. Different installations (and versions) of Liferay.
  10. Hi, The RepeaterFlex is interesting, but it does not appear in the Processwire site, nor in your demo site. Am I correct?
  11. Thanks for answering. It confirms what we found. I will prepare you something.
  12. Hi @teppo We have difficulty using your module with the TemplateEngineFactory and the attribution of $view. $view = wire("view"); $code = .....; $view->set('myVariable',$code); $view is NULL when trying to get a preview, so we get an error. Any idea how to resolve this? PS. This is the TemplateEngineFactory module that prevents previewing pages under /admin.
  13. I found the beginning of the solution. In ready.php, for example: $domainsToSwitch = [ 'domainEnOne.local' => 'default', 'domainEnTwo.local' => 'default', 'domainFrOne.local' => 'francais', 'domainFrTwo.local' => 'francais' ]; $host = config()->httpHost; if(array_key_exists($host, $domainsToSwitch)) { user()->language = wire("languages")->get($domainsToSwitch[$host]); }
  14. Hi Arjen, Thank you for your input. Just to be clear, each site has only a page tree with three or four languages, right? Soma's module takes care of the domain changes between language or you have coded something along?
  15. Hi Dragan, I have MAMP Pro and will do this without effort. I was just wanted to hear any experience on the particular subject. Remember that, apart from having 4 sites, each of them have two domains associated with them. Why keep it simple when you can make it complicated? 😉
  16. For more complicated reasons than any other, the customer must divest himself of his four sites made with Liferay. We do not have access to this CMS and I have to evaluate on behalf of a consultant who does not yet have all the information. The people who will work on the site are not technically very advanced even though they have a lot, a lot of money, it seems, they want something simple to use (Facebook syndrome). Some people will be administrators for the four sites, but others will operate only one site. Boards of directors may be a mix of roughly the same people with additions. In short, a beautiful spaghetti as this evaluation promises! I think the challenge is mainly to have a single connection for these four sites without using an LDAP server. I have to give an approximation of what the system might look like without doing the actual analysis at this time. Translated with www.DeepL.com/Translator
  17. Thank you for answering. The client is a financial group. They are all in the same building and they all know that their site have to be in both languages (it's almost a prerogative for doing things in Canada...) But I agree with you that I would got with 4 different instances. Since they will share the main design with perhaps difference in colors, there is certainly a way to make sure that the core CSS is identical.
  18. I know it is possible to have a different domain name for each language of a site. For exemple: monsite.com (for French) mysite.com (for English) I know also that we can have several sites in one installation with the help of Soma's Multisite module. I have a company who has four independent sites (four different companies under a same umbrella). The new design and structure of those sites will be practically identical. There will be different administrators for each site, but a lot of data will be shared, so using Soma's module seems to be a good idea. The problem is that those 4 sites have different names for the French and English version. compagnieUn.com (for French) companyOne.com (for English) compagnieDeux.com (for French) companyTwo.com (for English) etc. Will we shoot ourselves in our feet to develop with just one installation? Would it be preferable to make those sites able to talk to each other instead? Your input would be very much welcome!
  19. We finally discovered the culprit. An IPV6 entry that was still pointing to Pantheon. Everything should be ok by now.
  20. Some people have this strange problem. We did migrate from a Pantheon site (it was on Drupal, remember), and it's as if the SSL certificate is still stuck in Pantheon, which is not. My IT teams is on the case. Not all people has this problem.
  21. Bonjour @Nicolas, We started a long time ago to use https://modules.processwire.com/modules/template-engine-twig/. That code inspired one of our programmers to create his own module to take advantage of Twig 2.0 since the module Template Engine Twig still rely on Twig 1.35.
  22. Olá @Sergio, It would be great to let us know how you implemented ProCache in nginx. Out IT implemented the fastcgi cache present in nginx. Have you implemented both ProCache and that? Thanks for the suggestion, I will look into it. Please note that we published a revised version on our own website: https://www.spiria.com/en/blog/website-creation/choosing-processwire-for-spiria-com/
  23. Hi @Noel Boss, We simply add an extra selector in our query like this: $visitedLanguage = getVisitedLanguage(); if($visitedLanguage == "en") { $queryExtra = "non_existent_english!=1"; } else { $queryExtra = ""; }
×
×
  • Create New...