Pages Exporter/Importer
Methods for exporting and importing pages from one installation to another.
This class is primarily used interactively through the core ProcessPagesExportImport
module, but
can also be used from its API, described here.
$porter = new PagesExportImport(); // works in any version
$porter = $pages->porter(); // 3.0.253+ only
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the PagesExportImport
class also inherits all the methods and properties of: Wire.
Export
Name | Return | Summary | |
---|---|---|---|
$porter->exportJSON() $porter->exportJSON(PageArray $items) $porter->exportJSON(PageArray $items, array $options = []) | string | Export a PageArray to JSON string | |
$porter->exportZIP() $porter->exportZIP(PageArray $items) $porter->exportZIP(PageArray $items, array $options = []) | string | Export given PageArray to a ZIP file | |
$porter->getExportPath() $porter->getExportPath() $porter->getExportPath(string $subdir = '') | string | Get the path where ZIP exports are stored | |
$porter->getFieldInfo() $porter->getFieldInfo(Field $field) $porter->getFieldInfo(Field $field) | array | Returns array of information about given Field | |
$porter->pageToArray() $porter->pageToArray(Page $page, array $options) $porter->pageToArray(Page $page, array $options) | array | Export Page object to an array | |
$porter->pagesToArray() $porter->pagesToArray(PageArray $items) $porter->pagesToArray(PageArray $items, array $options = []) | array | Given a PageArray export it to a portable PHP array |
Import
Name | Return | Summary | |
---|---|---|---|
$porter->arrayToPage() $porter->arrayToPage(array $a) $porter->arrayToPage(array $a, array $options = []) | Page NullPage | Import an array of page data to a new Page (or update existing page) | |
$porter->arrayToPages() $porter->arrayToPages(array $a) $porter->arrayToPages(array $a, array $options = []) | PageArray int | Import an array of page data to create or update pages | |
$porter->getImportInfo() $porter->getImportInfo(array $a) $porter->getImportInfo(array $a) | array | Return array of info about the given import data array | |
$porter->importJSON() $porter->importJSON(string $json) $porter->importJSON(string $json, array $options = []) | PageArray bool | Import a PageArray from a JSON string | |
$porter->importZIP() $porter->importZIP(string $filename) $porter->importZIP(string $filename, array $options = []) | PageArray bool | Import ZIP file to create pages |
Cleanup
Name | Return | Summary | |
---|---|---|---|
$porter->cleanupFiles() $porter->cleanupFiles() $porter->cleanupFiles(int $maxAge = 3600) | int | Remove files and directories in /site/assets/backups/PagesExportImport/ that are older than $maxAge |
Additional methods and properties
In addition to the methods and properties above, PagesExportImport also inherits the methods and properties of these classes:
API reference based on ProcessWire core version 3.0.252