New in Sugar 6.2: Setting Config.php Variables On Silent Upgrades

bsoremsugar —  March 29, 2011 — 6 Comments

Editor’s Note: This articles details another new developer features that is coming coming in SugarCRM 6.2, now in beta. In this article, senior software engineer Collin Lee illustrates how to set config.php variables during the silent upgrade process.

Starting with version 6.2, we have added support in the silent upgrade scripts to automatically update or set configuration variables in the config.php file via the presence of a config_si.php file.  This feature is useful for administrators managing the upgrading of multiple SugarCRM installations who also need to add or change configuration values in the config.php file(s) of the existing installations.

Depending on where you run the silent upgrade scripts (say /home/upgrades) the silent upgrade scripts will check for the presence of a config_si.php file (i.e. file /home/upgrades/config_si.php) file and merge these settings to the config.php file directory of the upgrade instance.

Imagine the contents of /home/upgrades as:

silentUpgrade.php

silentUpgrade_step1.php

silentUpgrade_step2.php

config_si.php

And the contents of the config_si.php as:

<?php

$sugar_config_si = array(

‘disable_count_query’ => true,

‘external_cache_disabled_apc’ => true,

‘external_cache_disabled_zend’ => true,

‘external_cache_disabled_memcache’ => true,

‘external_cache_disabled’ => true,

‘system_skypeout_on’ => 1,

);

?>

So for example when running silent upgrade on command line:

/home/upgrades>php silentUpgrade.php “/home/upgrades/zip/SugarEnt-Upgrade-6.0.x-to-6.2.x.zip” “/home/upgrades/silent_upgrade.log” “/Applications/MAMP/htdocs/SugarEnt-Full-6.0.3” “admin”

The config.php file in the third argument (/Applications/MAMP/htdocs/SugarEnt-Full-6.0.3) will be the file that will be merged with config_si.php.  If the config.php file contains the existing key, then the value of this key will be altered to the value specified in config_si.php.  If the config.php file does not contain the declared key/value entry in config_si.php, then the config.php file will be updated to include the key/value combination.

6 responses to New in Sugar 6.2: Setting Config.php Variables On Silent Upgrades

  1. 
    Sugar super hero March 30, 2011 at 1:47 am

    How does it work with the config overwrite file then?
    thanks

    • 

      Hi, thank you for your question! We are thinking about how to approach this. I realize on the one hand the presence of the config_override.php file means that the Sugar administrator intentionally meant to override the configuration settings. In which case, we should NOT touch this file with our upgrade scripts. On the other hand, it could seem natural to apply custom configuration settings into the config_override.php file. In your line of handling upgrades, which would seem to be the proper protocol?

  2. 

    Nice piece. I was checking constantly this blog and I’m impressed! Very helpful information specially the last part. I care for such information a lot. I was looking for this particular information for a long time. Thank you and good luck.

  3. 
    web design dubai July 5, 2011 at 10:49 am

    very useful website!

  4. 

    Great read Owen. Thanks for sharing!

  5. 

    I think the last sentence here has an error: shouldn’t it be “… then the config.php file will be updated…”?
    As for the upgrade & override, I would only update the config.php and leave the override alone.. the admin can then compare the files later on if settings aren’t what they want them to be.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s