use of API instead of DAO instance
authormonishdeb <monish.deb@webaccessglobal.com>
Thu, 19 Feb 2015 11:37:15 +0000 (17:07 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Thu, 19 Feb 2015 11:37:15 +0000 (17:07 +0530)
install/index.php

index 2189e15908fc9640b58a17ead24781ebbc97a2aa..81d3de0b119a1f7025931243bc7ef672732c4880 100644 (file)
@@ -1433,13 +1433,17 @@ class Installer extends InstallRequirements {
 
       //change the default language to one chosen
       if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') {
-        $domain = new CRM_Core_DAO_Domain();
-        $domain->id = CRM_Core_Config::domainID();
-        $domain->find(TRUE);
-        $configSettings = unserialize($domain->config_backend);
-        $configSettings['lcMessages'] = $config['seedLanguage'];
-        $domain->config_backend = serialize($configSettings);
-        $domain->save();
+        $domainID = CRM_Core_Config::domainID();
+        $configBackend = civicrm_api3('Domain', 'getvalue', array('id' => $domainID, 'return'=> 'config_backend'));
+        $configBackend = unserialize($config_backend);
+
+        //TODO: Scope to set default attributes like for now e.g. Default Launguage
+        $configBackend['lcMessages'] = $config['seedLanguage'];
+        $result = civicrm_api3('Domain', 'setvalue', array(
+                    'id' => $domainID,
+                    'field' => 'config_backend',
+                    'value' => serialize($configBackend),
+                  ));
       }
     }