Jump to content

Guy Verville

Members
  • Posts

    204
  • Joined

  • Last visited

About Guy Verville

  • Birthday 03/02/1959

Contact Methods

  • Website URL
    http://www.guyverville.com
  • Skype
    guyverville

Profile Information

  • Gender
    Male
  • Location
    Montreal, Canada

Recent Profile Visitors

3,574 profile views

Guy Verville's Achievements

Sr. Member

Sr. Member (5/6)

125

Reputation

1

Community Answers

  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?
×
×
  • Create New...