Jump to content

Is there a way to batch ProcessPagesExportImport?


sodesign
 Share

Recommended Posts

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

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, []);
  • Like 4
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...