当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_Domain::resetDomain方法代码示例

本文整理汇总了PHP中CRM_Core_BAO_Domain::resetDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Domain::resetDomain方法的具体用法?PHP CRM_Core_BAO_Domain::resetDomain怎么用?PHP CRM_Core_BAO_Domain::resetDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_BAO_Domain的用法示例。


在下文中一共展示了CRM_Core_BAO_Domain::resetDomain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateSettingsFromMetaData

 /**
  * Look for any missing settings and convert them from config or load default as appropriate.
  * This should be run from GenCode & also from upgrades to add any new defaults.
  *
  * Multisites have often been overlooked in upgrade scripts so can be expected to be missing
  * a number of settings
  */
 public static function updateSettingsFromMetaData()
 {
     $apiParams = array('version' => 3, 'domain_id' => 'all', 'filters' => array('prefetch' => 0));
     $existing = civicrm_api('setting', 'get', $apiParams);
     if (!empty($existing['values'])) {
         $allSettings = civicrm_api('setting', 'getfields', array('version' => 3));
         foreach ($existing['values'] as $domainID => $domainSettings) {
             CRM_Core_BAO_Domain::setDomain($domainID);
             $missing = array_diff_key($allSettings['values'], $domainSettings);
             foreach ($missing as $name => $settings) {
                 self::convertConfigToSetting($name, $domainID);
             }
             CRM_Core_BAO_Domain::resetDomain();
         }
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:23,代码来源:Setting.php

示例2: getItems

 /**
  * Store multiple items in the setting table.
  *
  * @param array $params
  *   (required) An api formatted array of keys and values.
  * @param array $domains Array of domains to get settings for. Default is the current domain
  * @param $settingsToReturn
  *
  * @return array
  */
 public static function getItems(&$params, $domains = NULL, $settingsToReturn)
 {
     $originalDomain = CRM_Core_Config::domainID();
     if (empty($domains)) {
         $domains[] = $originalDomain;
     }
     if (!empty($settingsToReturn) && !is_array($settingsToReturn)) {
         $settingsToReturn = array($settingsToReturn);
     }
     $reloadConfig = FALSE;
     $fields = $result = array();
     $fieldsToGet = self::validateSettingsInput(array_flip($settingsToReturn), $fields, FALSE);
     foreach ($domains as $domainID) {
         if ($domainID != CRM_Core_Config::domainID()) {
             $reloadConfig = TRUE;
             CRM_Core_BAO_Domain::setDomain($domainID);
         }
         $config = CRM_Core_Config::singleton($reloadConfig, $reloadConfig);
         $result[$domainID] = array();
         foreach ($fieldsToGet as $name => $value) {
             $contactID = CRM_Utils_Array::value('contact_id', $params);
             $setting = CRM_Core_BAO_Setting::getItem(NULL, $name, NULL, NULL, $contactID, $domainID);
             if (!is_null($setting)) {
                 // we won't return if not set - helps in return all scenario - otherwise we can't indentify the missing ones
                 // e.g for revert of fill actions
                 $result[$domainID][$name] = $setting;
             }
         }
         CRM_Core_BAO_Domain::resetDomain();
     }
     return $result;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:42,代码来源:Setting.php

示例3: testSetConfigSetting

 /**
  * Setting api should set & fetch settings stored in config as well as those in settings table
  */
 public function testSetConfigSetting()
 {
     $config = CRM_Core_Config::singleton();
     $this->assertFalse($config->debug == 1);
     $params = array('domain_id' => $this->_domainID2, 'debug_enabled' => 1);
     $result = $this->callAPISuccess('setting', 'create', $params);
     CRM_Core_BAO_Domain::setDomain($this->_domainID2);
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     CRM_Core_BAO_Domain::resetDomain();
     $this->assertTrue($config->debug == 1);
     // this should NOT be stored in the settings table now - only in config
     $sql = " SELECT count(*) as c FROM civicrm_setting WHERE name LIKE '%maxFileSize%'";
     $dao = CRM_Core_DAO::executeQuery($sql);
     $dao->fetch();
     $this->assertEquals($dao->c, 0);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:19,代码来源:SettingTest.php

示例4: testSetConfigSetting

 /**
  * Setting api should set & fetch settings stored in config as well as those in settings table
  */
 public function testSetConfigSetting()
 {
     $config = CRM_Core_Config::singleton();
     $this->assertFalse($config->debug == 1);
     $params = array('domain_id' => $this->_domainID2, 'debug_enabled' => 1);
     $result = $this->callAPISuccess('setting', 'create', $params);
     $this->assertEquals(1, Civi::settings($this->_domainID2)->get('debug_enabled'));
     CRM_Core_BAO_Domain::setDomain($this->_domainID2);
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     CRM_Core_BAO_Domain::resetDomain();
     $this->assertEquals(1, $config->debug);
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:15,代码来源:SettingTest.php


注:本文中的CRM_Core_BAO_Domain::resetDomain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。