如何在plone 4.1中恢复已删除的文件夹?
答案 0 :(得分:7)
如果您尚未打包删除该文件夹的交易,则可以恢复该文件夹。
首先,使用"Undo" tab on the parent folder, in the ZMI。它可能不起作用,系统上有太多其他东西已经改变(通常是目录),因为所有的更改都可以有效地回滚。
下一步有点麻烦和参与。您当时要做的是打开对象数据库(ZODB),其中包装器将显示历史记录中给定点的数据库状态。这样做需要手动编辑Zope服务器配置。我written up the steps in a blog post但这些步骤有点过时了。
在现代Plone构建中,您需要将zc.beforestorage
鸡蛋添加到您的构建中,并且需要将Zope的enable-product-installation
设置切换为False
;使用beforestorage包装器使您的数据库成为只读,产品安装代码将尝试提交到数据库,导致无法启动:
[instance]
eggs +=
zc.beforestorage
zope-conf-additional +=
enable-product-installation False
重建buildout后,您需要打开与您的实例关联的zope.conf
文件。如果您通常使用bin/instance
启动服务器,则该文件位于parts/instance/etc/zope.conf
;使用的bin/
中的脚本与部件名称匹配(本例中为instance
)。
找到定义ZODB主数据库的部分:
<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>
您需要将beforestorage
包装器添加到该声明中:
<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>
注意那里的before <iso timestamp>
行;当您启动实例时,该网站将显示为该时间戳。在删除文件夹时选择一个。现在,您可以将其(再次使用ZMI)导出到.zexp
文件。撤消对zope.conf
文件的更改,重新启动并导入已恢复的文件夹。
答案 1 :(得分:3)
是的,可以使用相关文件夹上的Zope管理界面的“撤消”标签。这将回滚您删除文件夹的数据库事务,并且如果只删除了该文件夹,则效果最佳。其他信息位于:https://plone.org/documentation/kb/using-the-zope-undo-system-to-roll-back