To migrate all changes to all environments I use database upgrade scripts. I use them to create different instances(customer, tax settings etc.) but usually to migrate static blocks and config settings.
To migrate static blocks:
<?php
$block = Mage::getModel('cms/block');
$data = array(
'title' => 'Block title',
'identifier' => 'block_identifier',
'content' => 'block content',
'is_active' => 1,
'stores' => array(0 => Mage_Core_Model_App::ADMIN_STORE_ID),
);
$block->addData($data);
$block->save();
?>
To migrate settings:
<?php
Mage::getModel('core/config')->saveConfig('design/theme/default', 'theme');
?>
I know that we can modify Magento settings via config.xml:
<default>
<general>
<store_information>
<name>My Store</name>
</store_information>
<content_staging>
<block_frontend_stub>home</block_frontend_stub>
</content_staging>
</general>
</default>
But as far as I understand we can modify settings in such way only if paths: general/store_information/name
and
general/content_staging/block_frontend_stub
don't exists at db or their values equal NULL, if value not NULL we can't modify it via xml. I tested it on my local environment and I think I'm right but can't find a code at Magento which is responsible for setting configuration via xml.
Am I right?
Can you show me the part of code which is responsible for it? And what is your best migration practices for Magento? Maybe I don't know something :)