From: Jon goldberg Date: Thu, 30 Jun 2016 17:07:54 +0000 (-0400) Subject: CRM-19037 - API - use CRM_Core_Config instead of config_backend to find supported... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=56f96145b8f0835cecd4286f87e5438f70635c78;p=civicrm-core.git CRM-19037 - API - use CRM_Core_Config instead of config_backend to find supported languages --- diff --git a/Civi/API/Subscriber/I18nSubscriber.php b/Civi/API/Subscriber/I18nSubscriber.php index 11b72e9cec..42ed6bf60a 100644 --- a/Civi/API/Subscriber/I18nSubscriber.php +++ b/Civi/API/Subscriber/I18nSubscriber.php @@ -73,38 +73,35 @@ class I18nSubscriber implements EventSubscriberInterface { $domain->id = \CRM_Core_Config::domainID(); $domain->find(TRUE); - if ($domain->config_backend) { - $defaults = unserialize($domain->config_backend); + // are we in a multi-language setup? + $multiLang = $domain->locales ? TRUE : FALSE; + $lcMessages = NULL; - // are we in a multi-language setup? - $multiLang = $domain->locales ? TRUE : FALSE; - $lcMessages = NULL; - - // on multi-lang sites based on request and civicrm_uf_match - if ($multiLang) { - $languageLimit = array(); - if (array_key_exists('languageLimit', $defaults) && is_array($defaults['languageLimit'])) { - $languageLimit = $defaults['languageLimit']; - } + // on multi-lang sites based on request and civicrm_uf_match + if ($multiLang) { + $config = \CRM_Core_Config::singleton(); + $languageLimit = array(); + if (isset($config->languageLimit) and $config->languageLimit) { + $languageLimit = $config->languageLimit; + } - if (in_array($lcMessagesRequest, array_keys($languageLimit))) { - $lcMessages = $lcMessagesRequest; - } - else { - throw new \API_Exception(ts('Language not enabled: %1', array(1 => $lcMessagesRequest))); - } + if (in_array($lcMessagesRequest, array_keys($languageLimit))) { + $lcMessages = $lcMessagesRequest; + } + else { + throw new \API_Exception(ts('Language not enabled: %1', array(1 => $lcMessagesRequest))); } + } - global $dbLocale; + global $dbLocale; - // set suffix for table names - use views if more than one language - if ($lcMessages) { - $dbLocale = $multiLang && $lcMessages ? "_{$lcMessages}" : ''; + // set suffix for table names - use views if more than one language + if ($lcMessages) { + $dbLocale = $multiLang && $lcMessages ? "_{$lcMessages}" : ''; - // FIXME: an ugly hack to fix CRM-4041 - global $tsLocale; - $tsLocale = $lcMessages; - } + // FIXME: an ugly hack to fix CRM-4041 + global $tsLocale; + $tsLocale = $lcMessages; } }