問題描述
我們正在積極開發(fā)模塊,當(dāng)我們將更改推送到我們的生產(chǎn)站點時,通常需要進(jìn)行多項配置更改.自動化這個……想法會很好嗎?
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?
推薦答案
不確定它是否仍然是實際的,但如果你的意思是更改系統(tǒng) -> config,那么使用這樣的 config.xml 節(jié)點會更好編寫數(shù)據(jù)庫升級.
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 結(jié)構(gòu),因此您可以只更改 XML 結(jié)構(gòu),而無需使用 db 表來更改系統(tǒng)配置.
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 中的兩個作用域的一個配置字段發(fā)生了變化.它是根據(jù)當(dāng)前網(wǎng)站和商店定義的當(dāng)前主題.
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.
所以
節(jié)點包含特定商店的配置值.其中每個子元素都使用商店代碼命名,并在嵌套視圖中包含配置數(shù)據(jù).而
節(jié)點包含特定網(wǎng)站的配置值.其中每個子元素都使用網(wǎng)站代碼命名,并且還包含嵌套視圖中的配置數(shù)據(jù).
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.
還有可用的
節(jié)點用于全局范圍內(nèi)的配置值.但如果特定值用于范圍,它將被
和
覆蓋.
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 對配置進(jìn)行更改,因為當(dāng)您只需要通過 Magento 安裝程序進(jìn)行安裝而不需要更改系統(tǒng) -> 配置".
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".
這篇關(guān)于Magento:如何將配置更改從開發(fā)環(huán)境遷移到生產(chǎn)環(huán)境?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!