|
| 1 | +--- |
| 2 | +myst: |
| 3 | + html_meta: |
| 4 | + "description": "Export and import Plone site data with plone.exportimport" |
| 5 | + "property=og:description": "Export and import Plone site data with plone.exportimport" |
| 6 | + "property=og:title": "Export and import Plone site data with plone.exportimport" |
| 7 | + "keywords": "Plone 6, plone.exportimport, export, import, site, data, Content, Principals, Relations, Translations, Discussions, Redirects" |
| 8 | +--- |
| 9 | + |
| 10 | +(exportimport)= |
| 11 | + |
| 12 | +# Export and import site data |
| 13 | + |
| 14 | +The `plone.exportimport` package provides support to export and import all kinds of data from and to Plone sites using an intermediate JSON format. |
| 15 | + |
| 16 | +Most features use {doc}`plone.restapi <../plone.restapi/docs/source/index>` to serialize and deserialize data. |
| 17 | + |
| 18 | + |
| 19 | +## Command line utilities |
| 20 | + |
| 21 | +This package provides two command line utilities, `plone-exporter` and `plone-importer`. |
| 22 | + |
| 23 | +### `plone-exporter` |
| 24 | + |
| 25 | +Export content from a Plone site to a directory in the file system. |
| 26 | +You can call `plone-exporter` as shown. |
| 27 | + |
| 28 | +```shell |
| 29 | +plone-exporter [--include-revisions] <path-to-zopeconf> <site-id> <path-to-export-data> |
| 30 | +``` |
| 31 | + |
| 32 | +The following command shows typical usage. |
| 33 | + |
| 34 | +```shell |
| 35 | +plone-exporter instance/etc/zope.conf Plone /tmp/plone_data/ |
| 36 | +``` |
| 37 | + |
| 38 | +By default, the revisions history (older versions of each content item) are not exported. |
| 39 | +If you do want them, add `--include-revisions` on the command line. |
| 40 | + |
| 41 | + |
| 42 | +### `plone-importer` |
| 43 | + |
| 44 | +Import content from a file system directory into an existing Plone site. |
| 45 | + |
| 46 | +You can call `plone-importer` as shown. |
| 47 | + |
| 48 | +```shell |
| 49 | +plone-importer <path-to-zopeconf> <site-id> <path-to-import-data> |
| 50 | +``` |
| 51 | + |
| 52 | +The following command shows typical usage. |
| 53 | + |
| 54 | +```shell |
| 55 | +plone-importer instance/etc/zope.conf Plone /tmp/plone_data/ |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | +## Supported data |
| 60 | + |
| 61 | +- Content (Dexterity content items) |
| 62 | + - Ordering |
| 63 | + - Local roles |
| 64 | + - Versions (when using the `--include-revisions` command line option) |
| 65 | + - Default pages |
| 66 | +- Principals (members and groups) |
| 67 | +- Relations (relationships between content items) |
| 68 | +- Translations (translation groups) |
| 69 | +- Discussions (content comments) |
| 70 | +- Redirects (redirect information) |
| 71 | + |
| 72 | + |
| 73 | +## Exported data structure |
| 74 | + |
| 75 | +Some goals of the new data structure are to: |
| 76 | + |
| 77 | +- support diff of exported data, and |
| 78 | +- have blob files near the content item that uses it. |
| 79 | + |
| 80 | +After exporting content, at the top level directory, the following objects exist. |
| 81 | + |
| 82 | +| Name | Description | |
| 83 | +| --- | --- | |
| 84 | +| `content` | Directory containing content item information exported from the site | |
| 85 | +| `discussions.json` | JSON File with discussions (comments) exported from the site | |
| 86 | +| `principals.json` | JSON File with members and groups exported from the site | |
| 87 | +| `redirects.json` | JSON File with redirect information exported from the site | |
| 88 | +| `relations.json` | JSON File with content relations exported from the site | |
| 89 | +| `translations.json` | JSON File with translation groups exported from the site | |
| 90 | + |
| 91 | + |
| 92 | +### Content directory structure |
| 93 | + |
| 94 | +The {file}`content` directory contains all content items exported from the site. |
| 95 | +Each content item has its own subdirectory, named with the UID of the content, including the serialized data and all blob files related to this content. |
| 96 | + |
| 97 | +One special case is the directory for the `Plone Site` object, which is named `plone_site_root`. |
| 98 | + |
| 99 | +| Name | Description | |
| 100 | +| --- | --- | |
| 101 | +| `content/__metadata__.json` | JSON File with metadata information about the exported content | |
| 102 | +| `content/<content uid>` | Directory with serialization for a content item | |
| 103 | +| `content/plone_site_root` | Directory with serialization for the Plone Site Root | |
| 104 | + |
| 105 | + |
| 106 | +#### Content item directory structure |
| 107 | + |
| 108 | +Consider a File content item with UID `3e0dd7c4b2714eafa1d6fc6a1493f953` and a PDF file named {file}`plone.pdf` (added in the `file` field), the exported directory will have the following structure. |
| 109 | + |
| 110 | +| Name | Description | |
| 111 | +| --- | --- | |
| 112 | +| `content/3e0dd7c4b2714eafa1d6fc6a1493f953/data.json` | JSON File with serialized representation of a content item | |
| 113 | +| `content/3e0dd7c4b2714eafa1d6fc6a1493f953/file/plone.pdf` | Blob file stored in the `file` field in the content item | |
0 commit comments