Clearing all old versions of CMFEditions

We have a large huge site, the database of which should be prepared for the development of copies.

How to delete all old versions of the history of all content elements? Thus, we could significantly reduce the size of the data needed to transfer to the computers of developers.

Plone 4.0

+8
plone
source share
4 answers
  • Go to portal_purgepolicy and set the number for some number (usually I use "3" to save at least some history).
  • Run the following script:

    from DateTime import DateTime from Products.CMFCore.utils import getToolByName from Products.CMFEditions.utilities import dereference policy = getToolByName(self.context, 'portal_purgepolicy') catalog = getToolByName(self.context, 'portal_catalog') for count, brain in enumerate(catalog()): obj = brain.getObject() # only purge old content if obj.created() < (DateTime() - 30): obj, history_id = dereference(obj) policy.beforeSaveHook(history_id, obj) print 'purged object ' + obj.absolute_url_path() 
+14
source share

I have details for Plone 3 (but note that I know this has changed a bit to Plone 4).

In Plone 3.3 history, everything is stored inside the portal_historiesstorage / repo object. There you have the _shadowStorage subobject.

I found that if you delete this persistent object, it is created from scratch if necessary.

Hope this help will be somehow

+4
source share

Here are the _shadowStorage removal instructions, like the keul tips above:

Launch the ZEO client in debug mode:

  bin/client1 debug 

Then:

  del app.yoursiteid.portal_historiesstorage._shadowStorage import transaction ; transaction.commit() 

There is no guarantee. I do not know what he is deleting. Apparently, you get rid of all the stories.

+2
source share

I found (which was probably the case of RTFM in my case, but in any case) that opened the Zope site ( http: // localhost: 8080 / say) directly, and do the following:

  • manage page
  • "Control Panel"
  • "Database"
  • "Main"

led me to a page that suggested β€œpacking” the database and deleting the whole story older than X days. It worked like a treat!

0
source share

All Articles