Fixing Plone versioning for migrated sites

Versioning, revisions, and history are great new features in Plone 3 that allow you to track object changes and revert to earlier versions. But if you’ve migrated your site from versions prior to v3, it just doesn’t work: why? and how do you fix it?

I had this problem with a Plone 3.1.2 site, which started out at version 2.5 and has been incrementally upgraded and migrated to recent versions. In my sites, I got a History tab on every object, which contained a list of revisions and clickable links to compare versions and revert if necessary. However, all of these “compare revisions” version links came back with only the revision number and no text or diffs between versions. In addition, when I chose to “revert” to a previous revision, the portal message said that the object had been reverted, but the content remained exactly the same as the latest version, meaning no change had been made.

I’d also checked my site’s Site Setup -> Types settings to ensure that Versioning had been enabled for key content types (Page, File, etc.). But it still wasn’t working. Why?

This had to do with a bug in migrating my 2.5 site to v3, as Wichert Akkerman kindly explained: “There is a migration [bug] in Plone that forgets that set up [comparisons in portal_diff] when you are upgrading from Plone <3.0 so you may need to set that up manually.”

This was the information I needed in order to fix versioning on my sites.  In order to get versioning working properly on a site that has been migrated from pre-v3 to v3:

  1. In the ZMI, click portal_diff., or browse to [your_site]/portal_diff
  2. In my portal_diff tool, I saw only one existing entry for Folder types.  Use the Differences by Type form to add entries for other content types (Page, Topic, File, etc.) that duplicate these settings:
    • Type (Page, Topic, File, etc.)
    • any (you’ll need to type ‘any‘ in the text field)
    • a ‘diff’ method; I used ‘Compound Diff for AT Types’

    … and click Add field.  See the image for an example of what the tool might look like after you’ve added these fields:

    portal_diff

    portal_diff

  3. Click Update.  This may not be necessary, but it does return a message ‘Diff mappings updated’, which seems like it’s worth doing.
  4. After adding the desired fields, as mentioned above, in the Plone site’s Site Setup -> Types settings, ensure that Versioning is enabled.

That should do it: go visit an object in your site, make and save a change, and check the revisions in the object’s History for tracked changes and revertible versions.

Advertisements

One thought on “Fixing Plone versioning for migrated sites

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s