sodesign Posted June 8, 2023 Share Posted June 8, 2023 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? Thanks! Link to comment Share on other sites More sharing options...
sodesign Posted June 8, 2023 Author Share Posted June 8, 2023 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: <?php 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: <?php namespace ProcessWire; include "index.php"; // bootstrap ProcessWire $importer = new PagesExportImport(); $json = file_get_contents('resources-image.json'); $data = $importer->importJSON($json, []); 4 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now