I need to automatically change the value of 2 keys stored on Magento configuration. After some research I've reached the following snippet:
$config = Mage::getConfig(); $config->saveConfig('path1', $var1); $config->saveConfig('path2', $var2); $config->cleanCache(); Mage::app()->getConfig()->reinit(); Mage::app()->reinitStores(); Mage::app()->getStore()->resetConfig();
This script should work and indeed it does seem to work on the test machine. However on the production server I've noticed some problems. Sometimes only one of the configs changes leaving the system with an invalid state.
Should I only be changing one value, re-initiating and then changing the other value? Can you see any other problem with the script?