How could I recover deleted folder in plone 4.1?
If you haven't yet packed away the transaction that deleted the folder, you can recover the folder.
First, use the "Undo" tab on the parent folder, in the ZMI. It could that doesn't work, too many other things on the system have changed (usually the catalog), for all the changes to be rolled back effectively.
Next step is a little more cumbersome and involved. What you then have to do is open the Object Database (ZODB) with a wrapper that will show you the state of the database at a given point in history. Doing this requires some manual editing of your Zope server configuration. I've written up the steps in a blog post but those steps are a little outdated.
In a modern Plone buildout, you need to add the zc.beforestorage
egg to your buildout, and you need to switch the enable-product-installation
setting of Zope to False
; using the beforestorage wrapper makes your database read-only and the product installation code would try to commit to database, resulting in a failure to start:
[instance]
eggs +=
zc.beforestorage
zope-conf-additional +=
enable-product-installation False
After rebuilding the buildout, you need to open the zope.conf
file associated with your instance. If you normally start your server with bin/instance
, then that file is located in parts/instance/etc/zope.conf
; the script in bin/
used matches the part name (instance
in this example).
Locate the part where it defines the ZODB main database:
<zodb_db main>
# Main database
cache-size 10000
# Blob-enabled FileStorage database
<blobstorage>
blob-dir /path/to/var/blobstorage
<filestorage>
path /path/to/var/filestorage/Data.fs
</filestorage>
</blobstorage>
mount-point /
</zodb_db>
You need to add the beforestorage
wrapper into that declaration:
<zodb_db main>
# Main database
cache-size 10000
%import zc.beforestorage
<before>
before 2012-12-01T12:00:00
# Blob-enabled FileStorage database
<blobstorage>
blob-dir /path/to/var/blobstorage
<filestorage>
path /path/to/var/filestorage/Data.fs
</filestorage>
</blobstorage>
</before>
mount-point /
</zodb_db>
Note the before <iso timestamp>
line in there; when you start your instance, the site will be presented as it was at that timestamp. Choose one close to when you deleted the folder. Now you can export it (again using the ZMI) to a .zexp
file. Undo the changes to your zope.conf
file, restart, and import the recovered folder.