问题描述
我们正在积极开发模块,当我们将更改推送到我们的生产站点时,通常需要进行多项配置更改.自动化这个……想法会很好吗?
We are actively developing modules and when we push the changes to our production site, there are usually several configuration changes we need to make. Would be nice to automate this...thoughts?
推荐答案
不确定它是否仍然是实际的,但如果你的意思是更改系统 -> config,那么使用这样的 config.xml 节点会更好编写数据库升级.
Not sure if it is still actual, but if you mean changes to system -> config, then it is much more better to use such config.xml nodes instead of writing database upgrade.
Magneto 将 core_config_data
表处理为全局 XML 结构,因此您可以只更改 XML 结构,而无需使用 db 表来更改系统配置.
Magneto processes core_config_data
table into global XML structure, so you may just change XML structure without using db table for making changes to system configuration.
这是一个小例子:
<config>
<stores>
<french>
<design>
<theme>
<default>french</default>
<theme>
</design>
</french>
</stores>
<websites>
<base>
<design>
<theme>
<default>english</default>
<theme>
</design>
</base>
</websites>
</config>
在这个例子中,Magento 中的两个作用域的一个配置字段发生了变化.它是根据当前网站和商店定义的当前主题.
In this example one configuration field is changed for two scopes in Magento. It is definition of current theme depending on current website and store.
所以 节点包含特定商店的配置值.其中每个子元素都使用商店代码命名,并在嵌套视图中包含配置数据.而
节点包含特定网站的配置值.其中每个子元素都使用网站代码命名,并且还包含嵌套视图中的配置数据.
So <stores />
node contains configuration values for a particular store. Where each child element is named with store code and contains configuration data in nested view. And <website />
node contains configuration values for a particular website. Where each child element is named with website code and contains configuration data in nested view as well.
还有可用的 节点用于全局范围内的配置值.但如果特定值用于范围,它将被
和
覆盖.
Also there is available <default />
node for configuration values in global scope. But it will be overridden by <stores />
and <websites />
if a particular value is for a scope.
我仅通过 config.xml 对配置进行更改,因为当您只需要通过 Magento 安装程序进行安装而不需要更改系统 -> 配置".
I am making changes to configuration only via config.xml because deploying the project is much easier when you just need to install it via Magento installer without doing changes in"System -> Config".
这篇关于Magento:如何将配置更改从开发环境迁移到生产环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!