Commit 0e04f44e authored by eileen's avatar eileen

Add domain id to cachestring

parent 2ba45310
......@@ -53,6 +53,7 @@ class CRM_Core_BAO_ConfigSetting {
self::add($params);
$cache = CRM_Utils_Cache::singleton();
$cache->delete('CRM_Core_Config');
$cache->delete('CRM_Core_Config' . CRM_Core_Config::domainID());
$config = CRM_Core_Config::singleton(TRUE, TRUE);
}
......
......@@ -214,16 +214,23 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
* @access public
*/
static function getItems(&$params, $domains = null, $settingsToReturn) {
$originalDomain = CRM_Core_Config::domainID();
if (empty($domains)) {
$domains[] = CRM_Core_Config::domainID();
$domains[] = $originalDomain;
}
if (!empty($settingsToReturn) && !is_array($settingsToReturn)) {
$settingsToReturn = array($settingsToReturn);
}
$config = CRM_Core_Config::singleton();
$reloadConfig = FALSE;
$fields = $result = array();
$fieldsToGet = self::validateSettingsInput(array_flip($settingsToReturn), $fields, FALSE);
foreach ($domains as $domain) {
CRM_Core_BAO_Domain::setDomain($domain);
if($domain != $originalDomain){
$reloadConfig = TRUE;
}
$config = CRM_Core_Config::singleton($reloadConfig, $reloadConfig);
$result[$domain] = array();
foreach ($fieldsToGet as $name => $value) {
if(!empty($fields['values'][$name]['prefetch'])){
......@@ -248,6 +255,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
// e.g for revert of fill actions
$result[$domain][$name] = $setting;
}
CRM_Core_BAO_Domain::resetDomain();
}
}
return $result;
......
......@@ -184,8 +184,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
// first, attempt to get configuration object from cache
$cache = CRM_Utils_Cache::singleton();
self::$_singleton = $cache->get('CRM_Core_Config');
self::$_singleton = $cache->get('CRM_Core_Config' . CRM_Core_Config::domainID());
// if not in cache, fire off config construction
if (!self::$_singleton) {
self::$_singleton = new CRM_Core_Config;
......@@ -199,7 +198,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
// retrieve and overwrite stuff from the settings file
self::$_singleton->setCoreVariables();
}
$cache->set('CRM_Core_Config', self::$_singleton);
$cache->set('CRM_Core_Config' . CRM_Core_Config::domainID(), self::$_singleton);
}
else {
// we retrieve the object from memcache, so we now initialize the objects
......
......@@ -8,6 +8,6 @@ define('CIVICRM_USE_MEMCACHE', 1);
$config = &CRM_Core_Config::singleton();
$cache = &CRM_Utils_Cache::singleton();
$cache->set('CRM_Core_Config', $config);
CRM_Core_Error::debug('get', $cache->get('CRM_Core_Config'));
$cache->set('CRM_Core_Config' .CRM_Core_Config::domainID(), $config);
CRM_Core_Error::debug('get', $cache->get('CRM_Core_Config' . CRM_Core_Config::domainID()));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment