Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by sodesign

  1. Thank you for the pointers. I checked a new simple mutation on a different template and it was all ok.

    I checked the hooks we have running on the ConfiguratorQuote template I used in the original mutation and managed to find the problem. Surprisingly it was to do with a page saved hook ending up in an infinite loop. I'm not sure why it wasn't happening on the earlier core version but that's not a discussion for this board!

    Thanks for your help and looking into it so quickly 🙂  

  2. Hi @dadish,

    I've been using your module since 2018, and it's been really solid, thanks for all your work.

    I wonder if you can help with a recent issue I've had since updating Processwire core from 3.0.200 to 3.0.227+?

    I have a single mutation which creates a new page, and its fields are a mix of text fields, number fields, and page reference fields. Since updating PW core, the mutation hangs, and the only error I see is a 504 Timeout. The site seems to completely lock up as well when there's a pending query.

    Is there anything you can suggest to help debug this?  I'm running v2.0.0.


    PS -

    I've done a little more digging. I get the same problem with 1.4.1 and 2.0.0. There's no problem in PW 3.0.222, it only happens with 3.0.223 and higher.

    Here are a couple of screenshots showing the error in the GraphiQL tool - one with the error on 3.0.229, and one where it works on 3.0.200.

    Interestingly, although I get an error on 3.0.229, the page is created successfully, it just isn't reported as a success.

    successful request on PW 3-0-200.png

    unsuccessful request on PW 3-0-229.png

  3. Hi all,

    I'm having trouble with an import. Some translated text imports correctly, some doesn't. There are no errors or warnings displayed.


    We're running a big import on a file which was originally exported using the built in Export/Import module. Trying this both in the Admin, and by using 

    $importer = new PagesExportImport();

    Seems like some text imports correctly, some doesn't. Some fields which work are inside MatrixRepeaters, some are just fields on the page. The same field types even work some places but not others.

    The import runs without error, and the message shown suggests all the fields imported correctly.


    I have been trying to identify if anything is failing silently. I've been reading PagesExportImport.php and I think line #978 is the function call where the imported field content is saved:

    $page->set($field->name, $pageValue)

    The thing is, when I print the values either side of this function, the field values are correct. I'm not familiar enough with the inner workings of PW to really understand what might be going on. 

    Next steps

    Where else should I check? Are there any other functions used to save imported field content? 

    Or are there any better ways to go about debugging this?



    Edit - I've attached 2 screenshots. the Messages are with const debug = true; set in ProcessPagesExportImport.module. I believe they show that the import should have worked. The heading screenshot field shows that the translations didn't import correctly. I'm not sure if this is a bug or something I'm missing.  


    CleanShot 2023-06-14 at 13.43.35.png

    CleanShot 2023-06-14 at 13.43.03.png

    • Like 1
  4. Just to follow up - found out this is fairly simple to do with a php script. There are 2 important methods in wire/core/PagesExportImport.php

    I haven't dug into options or error handling, but this approach achieved what I needed it to.

    Ran this on website 1 to export the content:

    namespace ProcessWire;
    include "index.php"; // bootstrap ProcessWire
    $pages_to_export = $pages->find('template=my-template');
    $exporter = new PagesExportImport();
    $data = $exporter->exportJSON($pages_to_export, []);
    file_put_contents('resources-image.json', $data);

    and this on website 2 to import:

    namespace ProcessWire;
    include "index.php"; // bootstrap ProcessWire
    $importer = new PagesExportImport();
    $json = file_get_contents('resources-image.json');
    $data = $importer->importJSON($json, []);
    • Like 4
  5. Hi everyone,

    We have some huge pages filled with repeaters, each containing 100s of images/files and page reference fields.

    We need to migrate them to another site.

    Currently the Export fails (sometimes because we run out of memory, most times because the page times out.). Is there a way this module can batch the work? 

    Alternatively, is there any documentation for using this module in a script?


  6. That makes sense,  finding the connection between production 'media manager pages' and the staging usual pages media manager fields is where I was getting stuck trying to use a selector but your suggestion of looping through and creating the two arrays to compare is a great idea.

    The only question I still have is with point 8:

    9 hours ago, kongondo said:

    Loop through the newly imported pages in staging, loop through their MM fields and replace 1234 with 5623.

    How do I add a MM page to the MM field using the API if the field is currently empty? 

    I'll be sure to check out ProcessDatabaseBackups! Can it handle individual parts of a site?

  7. I wonder if anyone can help. I'm writing an import script to add a few hundred pages to a site, and each page has a media-manager-image field. (It's for a staging site where I'm merging some recent content from a production site to keep it up-to-date.)

    I successfully imported the pages using the native Processwire Import/Export, but the media manager fields were empty. I think this is because the page IDs are different on the production site and the staging site.

    I have also successfully imported all of the media manager pages and assets to the staging site.

    Is there a way I can populate the media-manager-image fields with the API? 

    Thanks in advance, I've been pulling my hair out trying to achieve this! 😅

    // I tried this approach, but it's not right
    $existing_image_path = extract_img_path($img); // custom function to parse CSV, eg '/site/assets/files/86258/an-image-name.jpg'
    $exists = wire('files')->exists($existing_image_path);
    if ($exists) {
    	// This doesn't work because it's not an image field
    // I then tried several ways like this, because the media is all on the staging site, but I couldn't find a way to query the media manager // pages successfully
    $filename = extract_img_filename($img); // custom function to parse CSV, eg 'an-image-name.jpg'
    $filename_query = "media_manager_image.filename=$filename";
    $m = wire('pages')->find("template=media-manager-image,$filename_query");
    if ($m->id > 0) {
    	// This doesn't work because it's not an image field
    	$p->blog_images = $m;


  8. Hi everyone,

    I'm working a on a big site redesign at the moment which requires a separate staging site.
    The client is regularly publishing changes on the production site which we occasionally need to merge across to the staging site, along with things like contact form entries.

    ProcessPagesExportImport generally does a great job here, but we're finding some instances where images aren't merged across.
    Specifically built-in image fields, images within CKEditor fields, images within repeaters, and media fields from the MediaManager module.
    Sometimes they migrate successfully, sometimes they don't. I'm not seeing any error messages or exceptions in the logs.

    Are there any gotchas I need to be aware of? I wondered if it might be to do with the fact pages have different IDs in production/staging, or that a page ID might already be occupied on staging by a different page.



  9. I'm writing a custom translation exported for a client and I'm having trouble outputting static translations in languages other than the default.

    Here's what I'm trying to do, but it's just outputting English both times. I must be missing something, but can't see anything in the docs or forum about how to acheive this. 

    function echoSnippet($string, $lang) {
      // Echo the string in english
      echo __($string);
      // Echo the string in german
      echo __($string);
    $lang = $languages->get("name=de");
    echoSnippet("Page not found", $lang);

     Does anyone have any pointers?


  10. Thanks for your reply @flydev ??

    I have looked through our nginx config, and I can see the lines

    fastcgi_ignore_headers Cache-Control Set-Cookie Expires;
    fastcgi_pass_header Set-Cookie;
    fastcgi_pass_header Cookie;
    fastcgi_cache OPS-FASTCGI;
    fastcgi_cache_valid 240m;
    fastcgi_cache_bypass $no_cache;
    fastcgi_no_cache $no_cache;

    The $no_cache param is set based on the request uri, and I did notice one 'private' url had been missed from the exclusions at the time of the issue.

    This really isn't my area of expertise, and we set up the config some time ago, inspired by Trellis (in wordpress land). I noticed someone questioned them about the inclusion of the fastcgi_pass_header Set-Cookie property (https://discourse.roots.io/t/nginx-caching-configuration-in-trellis/7056)

    Would removing fastcgi_pass_header Set-Cookie be a good idea? Is there any reason this would need to be passed?

  11. 13 hours ago, dadish said:

    @sodesign Not sure if you still need this but this release brings support for interfaces that I previously talked about. Hope you'll find it helpful.

    That's great news, and thanks for letting me know.

    I've recently been working on a nuxt.js project with Craft CMS which uses interfaces, and I'm very excited to now have this capability in PW as well.

  12. Hello,

    I manage a client website which use PW and Padloper for ecommerce.

    We recently had an issue where customers were seeing other customers' baskets and prefilled form data on the checkout form.
    From what I saw, the data was not users who had accounts, just data which was held in their sessions.

    I think I have narrowed this down to being caused by nginx fast-cgi caching, but I do not know enough about how this works to be certain.

    I have a couple of questions:

    • Can fast-cgi cached cause session data to be shared, leaked or incorrectly assigned?
    • Can fast-cgi cache provide authentication to unauthorised users?

    I'm reasonably confident that the whole shop cart and checkout bypassed the cache, so is it possible that somebody could 'swap' sessions on a diffetent part of the site which shouldn't have been cached?

    I don't have a great deal of knowlegde of how sessions, caching and cookies work and fit together, so if it's likely that the fastcgi-cache isn't the problem, can anyone point me in the direction of what might be?


  13. On 12/13/2019 at 4:11 PM, dadish said:

    The children results only have with built-in page fields.

    I have one more question - do you plan to include child template fields?

    If not, what is your recommendation for querying child pages?


  • Create New...