Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8171049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:20:12+00:00 2026-06-06T21:20:12+00:00

To migrate all changes to all environments I use database upgrade scripts. I use

  • 0

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 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:20:13+00:00Added an answer on June 6, 2026 at 9:20 pm

    You are right, values specified in the config xml files are overwritten by values from the core_config_data table.
    As B00MER pointed out, the code in question is in Mage_Core_Model_Config::init():

    public function init($options=array())
    {
        $this->setCacheChecksum(null);
        $this->_cacheLoadedSections = array();
        $this->setOptions($options);
        $this->loadBase();
    
        $cacheLoad = $this->loadModulesCache();
        if ($cacheLoad) {
            return $this;
        }
        $this->loadModules();
        $this->loadDb();
        $this->saveCache();
        return $this;
    }
    

    Notice that loadDb() is called after loadModules().
    The actual merging logic is in the config resource model Mage_Core_Model_Resource_Config::loadToXml().

    For each global setting this is called:

    $xmlConfig->setNode('default/' . $r['path'], $value);
    

    For each website scope setting this is called:

    $nodePath = sprintf('websites/%s/%s', $websites[$r['scope_id']]['code'], $r['path']);
    $xmlConfig->setNode($nodePath, $value);
    

    For each website scope setting this is called:

    $nodePath = sprintf('stores/%s/%s', $stores[$r['scope_id']]['code'], $r['path']);
    $xmlConfig->setNode($nodePath, $value);
    

    This is slightly simplified, but if you need more detail you can look at the source.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does rake db:migrate only add new migrations, or does it drop all migrations/changes and
The command rake db:migrate will apply all relevant new migrations to a database and
I would like to migrate all my unit tests from NUnit to MSTest. In
We migrate from WinForms to WPF... slowly =) No we use WPF User Controls
I'm attempting to migrate a database with a SQL file I was provided. However,
We're looking to iron out issues in our different dev/test/prod environments. Currently we have
I have created an app using a badly named database, all alterations to important
If I edit my shema, and run db:migrate the database doesn't changed, but if
I have an application that uses a SQL Server database with several instances of
I'm trying some db schema changes to my db, using the sqlalchemy table.create and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.