如何防止在重新安装软件包时覆盖自定义注册表项的值? [英] How do I prevent values of custom registry entries to be overwritten on reinstall of my package?

查看:189
本文介绍了如何防止在重新安装软件包时覆盖自定义注册表项的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的软件包引入了注册表项.重新安装该软件包时,不应覆盖站点管理员所做的更改.

My package introduces registry entries. Changes by site administrator should not be overwritten on reinstall of the package.

有很多前往罗马的方式.我选择了ftw.upgrade.我喜欢升级步骤语法的声明方式.可以将升级目录用于通用设置xml文件,例如propertiestool.xml.无需定义处理程序python代码.升级效果很好.管理员可以从控制面板升级,在我的情况下,将添加新属性. Insomma:对于新属性,只需添加以下内容:源和目标版本以及在其中找到properties.xml的目录的升级步骤声明.竖起大拇指! –

Many ways to Rome. I chose ftw.upgrade. I like the declarative way of the upgrade step syntax. Its possible to use an upgrade directory for generic setup xml-Files like propertiestool.xml. No need to define handler python code. The upgrade works well. The admin can upgrade from control panel and in my case the new property is added. Insomma: For a new property just these have to be added: an upgrade-step declaration for source and destination version and directory where to find the properties.xml. Thumb up! –

推荐答案

您可以通过在内部提供带有install方法的Extension/install.py文件来试用安装Plone附加组件的操作:

You can pilot what to do when installing a Plone add-on by providing an Extension/install.py file with a install method inside:

def install(portal, reinstall=False):
    if not reinstall:
        setup_tool = portal.portal_setup
        setup_tool.runAllImportStepsFromProfile('profile-your.pfile:default')

通过这种方式,您可以驱动Plone在安装时应该执行的操作.

This way you are driving what Plone should do when installing.

如果需要:卸载相同:

def uninstall(portal, reinstall=False):
    if not reinstall:
        setup_tool = portal.portal_setup
        setup_tool.runAllImportStepsFromProfile('profile-example.gs:uninstall')

这样,您可以防止重新安装时运行卸载步骤.

This way you can prevent the uninstall step to be run when reinstalling.

警告:如Mathias建议使用快速安装程序->重新安装功能错误.

Warning: as Mathias suggested using quickinstaller -> reinstall feature is bad.

警告:在Plone 5上这可能不再起作用(对此进行公开讨论).

Warning: this will not probably work anymore on Plone 5 (there's open discussion about this).

这篇关于如何防止在重新安装软件包时覆盖自定义注册表项的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆