This is Part 3 of the documentation of my migration from plone to wordpress. Read the previous posts for my reasons to choose wordpress as CMS of choice and about the intermediate data export from plone to the file system.
As outlined in my previous post all data from the plone site is exported to an intermediate data represenation on the local file system in JSON format.
For the data import the excellent XML-RPC capabilities of wordpress are used. This interface allows the script-controlled creation of content in any given wordpress site. For python, there is the excellent python-wordpress-xmlrpc library that comes with a pretty good documentation.
For the import I developed a python script which sequentially reads the JSON-data from my local harddrive, analyzes each entity and creates the corresponding wordpress content objects.
Python-Script for Import
The import script I developed and used as part of my migration process is written in python and uses the coresponding xml-rpc library. The basic functionality is as follows:
- WordPress pages are created for all Plone Articles. For folderish items the default content item is used or – if no item present – an empty page with a user-defined text is created.
- WordPress blog posts are created for all Plone NewsItems. Categories are defined according to the tags of the plone newsitem.
- For all blobs i.e. for file items and images files are uploaded and corresponding landing page with a link to the uploaded files are generated. The creation of landing pages can be enabled or disabled via an option.
All content items are created with the correct creation, publication and modification data. If wanted, a mapping table between plone URL and wordpress URL (and id) is written during import in CSV format . This file can be used to define redirections using e.g the redirection plugin for wordpress.
The script is available for download:
Please configure the script according to your needs. The configuration options are at the top of the script.
With the data imported into wordpress the final step of the migration from plone to wordpress means to fix all things that need fixing. It is time to wrap things up.