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


PHP CRM_Core_BAO_Cache类代码示例

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


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

示例1: importableFields

 static function importableFields($contactType = 'HRJobContractRevision', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'HRJobContractRevision';
     }
     $cacheKeyString = "";
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $showAll ? '_1' : '_0';
     $cacheKeyString .= $isProfile ? '_1' : '_0';
     $cacheKeyString .= $checkPermission ? '_1' : '_0';
     $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
     if (!$fields) {
         $fields = CRM_Hrjobcontract_DAO_HRJobContractRevision::import();
         $fields = array_merge($fields, CRM_Hrjobcontract_DAO_HRJobContractRevision::import());
         //Sorting fields in alphabetical order(CRM-1507)
         $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title');
         $fields = CRM_Utils_Array::index(array('name'), $fields);
         CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
     }
     self::$_importableFields[$cacheKeyString] = $fields;
     if (!$isProfile) {
         $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:25,代码来源:HRJobContractRevision.php

示例2: importableFields

 /**
  * combine all the importable fields from the lower levels object
  *
  * The ordering is important, since currently we do not have a weight
  * scheme. Adding weight is super important
  *
  * @param int     $contactType     contact Type
  * @param boolean $status          status is used to manipulate first title
  * @param boolean $showAll         if true returns all fields (includes disabled fields)
  * @param boolean $isProfile       if its profile mode
  * @param boolean $checkPermission if false, do not include permissioning clause (for custom data)
  *
  * @return array array of importable Fields
  * @access public
  * @static
  */
 static function importableFields($contactType = 'HRJobLeave', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'HRJobLeave';
     }
     $cacheKeyString = "";
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $showAll ? '_1' : '_0';
     $cacheKeyString .= $isProfile ? '_1' : '_0';
     $cacheKeyString .= $checkPermission ? '_1' : '_0';
     $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
     if (!$fields) {
         $fields = CRM_HRJob_DAO_HRJobLeave::import();
         $fields = array_merge($fields, CRM_HRJOB_DAO_HRJOBLEAVE::import());
         foreach ($fields as $key => $v) {
             $fields[$key]['hasLocationType'] = TRUE;
         }
         //Sorting fields in alphabetical order
         $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title');
         $fields = CRM_Utils_Array::index(array('name'), $fields);
         CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
     }
     self::$_importableFields[$cacheKeyString] = $fields;
     if (!$isProfile) {
         $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:44,代码来源:HRJobLeave.php

示例3: batchSave

 function batchSave()
 {
     // save in cache table
     $batchId = CRM_Utils_Type::escape($_POST['batch_id'], 'Positive');
     $cacheKeyString = CRM_Core_BAO_Batch::getCacheKeyForBatch($batchId);
     // check if we can retrieve from database cache
     unset($_POST['qfKey']);
     CRM_Core_BAO_Cache::setItem($_POST, 'batch entry', $cacheKeyString);
     // return true if saved correctly
     CRM_Utils_System::civiExit();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:11,代码来源:AJAX.php

示例4: testFlush

 /**
  * Test system flush.
  */
 public function testFlush()
 {
     // Note: this operation actually flushes several different caches; we don't
     // check all of them -- just enough to make sure that the API is doing
     // something
     $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
     $data = 'abc';
     CRM_Core_BAO_Cache::setItem($data, self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH);
     $this->assertEquals('abc', CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
     $params = array();
     $result = $this->callAPIAndDocument('system', 'flush', $params, __FUNCTION__, __FILE__, "Flush all system caches", 'Flush');
     $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:16,代码来源:SystemTest.php

示例5: testSetGetItem

 public function testSetGetItem()
 {
     $originalValue = array('abc' => 'def');
     CRM_Core_BAO_Cache::setItem($originalValue, __CLASS__, 'testSetGetItem');
     $return_1 = CRM_Core_BAO_Cache::getItem(__CLASS__, 'testSetGetItem');
     $this->assertEquals($originalValue, $return_1);
     // Wipe out any in-memory copies of the cache. Check to see if the SQL
     // read is correct.
     CRM_Core_BAO_Cache::$_cache = NULL;
     CRM_Utils_Cache::$_singleton = NULL;
     $return_2 = CRM_Core_BAO_Cache::getItem(__CLASS__, 'testSetGetItem');
     $this->assertEquals($originalValue, $return_2);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:13,代码来源:CacheTest.php

示例6: buildPrevNextCache

 function buildPrevNextCache($sort)
 {
     //for prev/next pagination
     $crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject);
     if (!$crmPID) {
         $cacheKey = "civicrm search {$this->_key}";
         CRM_Core_BAO_PrevNextCache::deleteItem(NULL, $cacheKey, 'civicrm_contact');
         $sql = $this->_query->searchQuery(0, 0, $sort, FALSE, FALSE, FALSE, FALSE, TRUE, $this->_campaignWhereClause, NULL, $this->_campaignFromClause);
         list($select, $from) = explode(' FROM ', $sql);
         $insertSQL = "\nINSERT INTO civicrm_prevnext_cache ( entity_table, entity_id1, entity_id2, cacheKey, data )\nSELECT 'civicrm_contact', contact_a.id, contact_a.id, '{$cacheKey}', contact_a.display_name\nFROM {$from}\n";
         CRM_Core_Error::ignoreException();
         $result = CRM_Core_DAO::executeQuery($insertSQL);
         CRM_Core_Error::setCallback();
         if (is_a($result, 'DB_Error')) {
             return;
         }
         // also record an entry in the cache key table, so we can delete it periodically
         CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:20,代码来源:Search.php

示例7: resetNavigation

 /**
  * Reset navigation for all contacts
  */
 static function resetNavigation()
 {
     $query = "UPDATE civicrm_preferences SET navigation = NULL WHERE contact_id IS NOT NULL";
     CRM_Core_DAO::executeQuery($query);
     require_once 'CRM/Core/BAO/Cache.php';
     CRM_Core_BAO_Cache::deleteGroup('navigation');
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:10,代码来源:Navigation.php

示例8: prefetch

 function prefetch()
 {
     $this->frontCache = CRM_Core_BAO_Cache::getItems($this->group, $this->componentID);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:4,代码来源:SqlGroup.php

示例9: loadSettingsMetadata

 /**
  * Load up settings metadata from files.
  */
 public static function loadSettingsMetadata($metaDataFolder)
 {
     $settingMetaData = array();
     $settingsFiles = CRM_Utils_File::findFiles($metaDataFolder, '*.setting.php');
     foreach ($settingsFiles as $file) {
         $settings = (include $file);
         $settingMetaData = array_merge($settingMetaData, $settings);
     }
     CRM_Core_BAO_Cache::setItem($settingMetaData, 'CiviCRM setting Spec', 'All');
     return $settingMetaData;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:14,代码来源:Setting.php

示例10: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $params['actualBatchTotal'] = 0;
     // get the profile information
     if ($this->_batchInfo['type_id'] == 1) {
         $this->processContribution($params);
     } else {
         $this->processMembership($params);
     }
     // update batch to close status
     $paramValues = array('id' => $this->_batchId, 'status_id' => 2, 'total' => $params['actualBatchTotal']);
     CRM_Core_BAO_Batch::create($paramValues);
     // delete from cache table
     $cacheKeyString = CRM_Core_BAO_Batch::getCacheKeyForBatch($this->_batchId);
     CRM_Core_BAO_Cache::deleteGroup('batch entry', $cacheKeyString, FALSE);
     // set success status
     CRM_Core_Session::setStatus("Your batch has been processed.");
     CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/batch', 'reset=1&status=2'));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:27,代码来源:Entry.php

示例11: importableFields

 /**
  * combine all the importable fields from the lower levels object
  *
  * The ordering is important, since currently we do not have a weight
  * scheme. Adding weight is super important
  *
  * @param int     $contactType     contact Type
  * @param boolean $status          status is used to manipulate first title
  * @param boolean $showAll         if true returns all fields (includes disabled fields)
  * @param boolean $isProfile       if its profile mode
  * @param boolean $checkPermission if false, do not include permissioning clause (for custom data)
  *
  * @return array array of importable Fields
  * @access public
  * @static
  */
 static function importableFields($contactType = 'Individual', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
 {
     $cacheKeyString = "";
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $showAll ? '_1' : '_0';
     $cacheKeyString .= $isProfile ? '_1' : '_0';
     $cacheKeyString .= $checkPermission ? '_1' : '_0';
     $contactType = 'Individual';
     $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
     if (!$fields) {
         $fields = CRM_Appraisals_DAO_AppraisalCycle::import();
         $tmpContactField = $contactFields = array();
         $contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
         // Using new Dedupe rule.
         $ruleParams = array('contact_type' => $contactType, 'used' => 'Unsupervised');
         $fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
         if (is_array($fieldsArray)) {
             foreach ($fieldsArray as $value) {
                 $customFieldId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $value, 'id', 'column_name');
                 $value = $customFieldId ? 'custom_' . $customFieldId : $value;
                 $tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
                 if (!$status) {
                     $title = $tmpContactField[trim($value)]['title'] . ' (match to contact)';
                 } else {
                     $title = $tmpContactField[trim($value)]['title'];
                 }
                 $tmpContactField[trim($value)]['title'] = $title;
             }
         }
         $extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
         if ($extIdentifier) {
             $tmpContactField['external_identifier'] = $extIdentifier;
             $tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
         }
         $fields = array_merge($fields, $tmpContactField);
         //Sorting fields in alphabetical order(CRM-1507)
         $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title');
         $fields = CRM_Utils_Array::index(array('name'), $fields);
         CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
     }
     self::$_importableFields[$cacheKeyString] = $fields;
     if (!$isProfile) {
         $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:62,代码来源:AppraisalCycle.php

示例12: array

 /**
  * Combine all the exportable fields from the lower levels object.
  *
  * Currently we are using importable fields as exportable fields
  *
  * @param int|string $contactType contact Type
  * @param bool $status
  *   True while exporting primary contacts.
  * @param bool $export
  *   True when used during export.
  * @param bool $search
  *   True when used during search, might conflict with export param?.
  *
  * @param bool $withMultiRecord
  *
  * @return array
  *   array of exportable Fields
  */
 public static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'All';
     }
     $cacheKeyString = "exportableFields {$contactType}";
     $cacheKeyString .= $export ? '_1' : '_0';
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $search ? '_1' : '_0';
     //CRM-14501 it turns out that the impact of permissioning here is sometimes inconsistent. The field that
     //calculates custom fields takes into account the logged in user & caches that for all users
     //as an interim fix we will cache the fields by contact
     $cacheKeyString .= '_' . CRM_Core_Session::getLoggedInContactID();
     if (!self::$_exportableFields || !CRM_Utils_Array::value($cacheKeyString, self::$_exportableFields)) {
         if (!self::$_exportableFields) {
             self::$_exportableFields = array();
         }
         // check if we can retrieve from database cache
         $fields = CRM_Core_BAO_Cache::getItem('contact fields', $cacheKeyString);
         if (!$fields) {
             $fields = CRM_Contact_DAO_Contact::export();
             // The fields are meant for contact types.
             if (in_array($contactType, array('Individual', 'Household', 'Organization', 'All'))) {
                 $fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
             }
             // add current employer for individuals
             $fields = array_merge($fields, array('current_employer' => array('name' => 'organization_name', 'title' => ts('Current Employer'))));
             $locationType = array('location_type' => array('name' => 'location_type', 'where' => 'civicrm_location_type.name', 'title' => ts('Location Type')));
             $IMProvider = array('im_provider' => array('name' => 'im_provider', 'where' => 'civicrm_im.provider_id', 'title' => ts('IM Provider')));
             $locationFields = array_merge($locationType, CRM_Core_DAO_Address::export(), CRM_Core_DAO_Phone::export(), CRM_Core_DAO_Email::export(), $IMProvider, CRM_Core_DAO_IM::export(TRUE), CRM_Core_DAO_OpenID::export());
             $locationFields = array_merge($locationFields, CRM_Core_BAO_CustomField::getFieldsForImport('Address'));
             foreach ($locationFields as $key => $field) {
                 $locationFields[$key]['hasLocationType'] = TRUE;
             }
             $fields = array_merge($fields, $locationFields);
             //add world region
             $fields = array_merge($fields, CRM_Core_DAO_Worldregion::export());
             $fields = array_merge($fields, CRM_Contact_DAO_Contact::export());
             //website fields
             $fields = array_merge($fields, CRM_Core_DAO_Website::export());
             if ($contactType != 'All') {
                 $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($contactType, $status, FALSE, $search, TRUE, $withMultiRecord));
             } else {
                 foreach (array('Individual', 'Household', 'Organization') as $type) {
                     $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($type, FALSE, FALSE, $search, TRUE, $withMultiRecord));
                 }
             }
             //fix for CRM-791
             if ($export) {
                 $fields = array_merge($fields, array('groups' => array('title' => ts('Group(s)'), 'name' => 'groups'), 'tags' => array('title' => ts('Tag(s)'), 'name' => 'tags'), 'notes' => array('title' => ts('Note(s)'), 'name' => 'notes')));
             } else {
                 $fields = array_merge($fields, array('group' => array('title' => ts('Group(s)'), 'name' => 'group'), 'tag' => array('title' => ts('Tag(s)'), 'name' => 'tag'), 'note' => array('title' => ts('Note(s)'), 'name' => 'note')));
             }
             //Sorting fields in alphabetical order(CRM-1507)
             foreach ($fields as $k => $v) {
                 $sortArray[$k] = CRM_Utils_Array::value('title', $v);
             }
             $fields = array_merge($sortArray, $fields);
             //unset the field which are not related to their contact type.
             if ($contactType != 'All') {
                 $commonValues = array('Individual' => array('household_name', 'legal_name', 'sic_code', 'organization_name', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom'), 'Household' => array('first_name', 'middle_name', 'last_name', 'formal_title', 'job_title', 'gender_id', 'prefix_id', 'suffix_id', 'birth_date', 'organization_name', 'legal_name', 'legal_identifier', 'sic_code', 'home_URL', 'is_deceased', 'deceased_date', 'current_employer', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom', 'prefix_id', 'suffix_id'), 'Organization' => array('first_name', 'middle_name', 'last_name', 'formal_title', 'job_title', 'gender_id', 'prefix_id', 'suffix_id', 'birth_date', 'household_name', 'email_greeting_custom', 'postal_greeting_custom', 'prefix_id', 'suffix_id', 'gender_id', 'addressee_custom', 'is_deceased', 'deceased_date', 'current_employer'));
                 foreach ($commonValues[$contactType] as $value) {
                     unset($fields[$value]);
                 }
             }
             CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
         }
         self::$_exportableFields[$cacheKeyString] = $fields;
     }
     if (!$status) {
         $fields = self::$_exportableFields[$cacheKeyString];
     } else {
         $fields = array_merge(array('' => array('title' => ts('- Contact Fields -'))), self::$_exportableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:94,代码来源:Contact.php

示例13: setIsActive

 /**
  * update the is_active flag in the db
  *
  * @param int      $id        id of the database record
  * @param boolean  $is_active value we want to set the is_active field
  *
  * @return Object             DAO object on sucess, null otherwise
  * @static
  */
 static function setIsActive($id, $is_active)
 {
     // note this also resets any ACL cache
     CRM_Core_BAO_Cache::deleteGroup('contact fields');
     return CRM_Core_DAO::setFieldValue('CRM_ACL_DAO_ACL', $id, 'is_active', $is_active);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:15,代码来源:ACL.php

示例14: implode

 /**
  * Create a new group.
  *
  * @param array $params
  *
  * @return CRM_Contact_BAO_Group|NULL
  *   The new group BAO (if created)
  */
 public static function &create(&$params)
 {
     if (!empty($params['id'])) {
         CRM_Utils_Hook::pre('edit', 'Group', $params['id'], $params);
     } else {
         CRM_Utils_Hook::pre('create', 'Group', NULL, $params);
     }
     // form the name only if missing: CRM-627
     $nameParam = CRM_Utils_Array::value('name', $params, NULL);
     if (!$nameParam && empty($params['id'])) {
         $params['name'] = CRM_Utils_String::titleToVar($params['title']);
     }
     // convert params if array type
     if (isset($params['group_type'])) {
         if (is_array($params['group_type'])) {
             $params['group_type'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['group_type'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         }
     } else {
         $params['group_type'] = '';
     }
     $session = CRM_Core_Session::singleton();
     $cid = $session->get('userID');
     // this action is add
     if ($cid && empty($params['id'])) {
         $params['created_id'] = $cid;
     }
     // this action is update
     if ($cid && !empty($params['id'])) {
         $params['modified_id'] = $cid;
     }
     $group = new CRM_Contact_BAO_Group();
     $group->copyValues($params);
     //@todo very hacky fix for the fact this function wants to receive 'parents' as an array further down but
     // needs it as a separated string for the DB. Preferred approaches are having the copyParams or save fn
     // use metadata to translate the array to the appropriate DB type or altering the param in the api layer,
     // or at least altering the param in same section as 'group_type' rather than repeating here. However, further down
     // we need the $params one to be in it's original form & we are not sure what test coverage we have on that
     if (isset($group->parents) && is_array($group->parents)) {
         $group->parents = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($group->parents)) . CRM_Core_DAO::VALUE_SEPARATOR;
     }
     if (empty($params['id']) && !$nameParam) {
         $group->name .= "_tmp";
     }
     $group->save();
     if (!$group->id) {
         return NULL;
     }
     if (empty($params['id']) && !$nameParam) {
         $group->name = substr($group->name, 0, -4) . "_{$group->id}";
     }
     $group->buildClause();
     $group->save();
     // add custom field values
     if (!empty($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_group', $group->id);
     }
     // make the group, child of domain/site group by default.
     $domainGroupID = CRM_Core_BAO_Domain::getGroupId();
     if (CRM_Utils_Array::value('no_parent', $params) !== 1) {
         if (empty($params['parents']) && $domainGroupID != $group->id && CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'is_enabled') && !CRM_Contact_BAO_GroupNesting::hasParentGroups($group->id)) {
             // if no parent present and the group doesn't already have any parents,
             // make sure site group goes as parent
             $params['parents'] = array($domainGroupID => 1);
         } elseif (array_key_exists('parents', $params) && !is_array($params['parents'])) {
             $params['parents'] = array($params['parents'] => 1);
         }
         if (!empty($params['parents'])) {
             foreach ($params['parents'] as $parentId => $dnc) {
                 if ($parentId && !CRM_Contact_BAO_GroupNesting::isParentChild($parentId, $group->id)) {
                     CRM_Contact_BAO_GroupNesting::add($parentId, $group->id);
                 }
             }
         }
         // clear any descendant groups cache if exists
         $finalGroups = CRM_Core_BAO_Cache::deleteGroup('descendant groups for an org');
         // this is always required, since we don't know when a
         // parent group is removed
         CRM_Contact_BAO_GroupNestingCache::update();
         // update group contact cache for all parent groups
         $parentIds = CRM_Contact_BAO_GroupNesting::getParentGroupIds($group->id);
         foreach ($parentIds as $parentId) {
             CRM_Contact_BAO_GroupContactCache::add($parentId);
         }
     }
     if (!empty($params['organization_id'])) {
         $groupOrg = array();
         $groupOrg = $params;
         $groupOrg['group_id'] = $group->id;
         CRM_Contact_BAO_GroupOrganization::add($groupOrg);
     }
     CRM_Contact_BAO_GroupContactCache::add($group->id);
     if (!empty($params['id'])) {
//.........这里部分代码省略.........
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:101,代码来源:Group.php

示例15: testGetExtensionSetting

 /**
  * Check that setting defined in extension can be retrieved.
  */
 public function testGetExtensionSetting()
 {
     $this->hookClass->setHook('civicrm_alterSettingsFolders', array($this, 'setExtensionMetadata'));
     $data = NULL;
     // the caching of data to all duplicates the caching of data to the empty string
     CRM_Core_BAO_Cache::setItem($data, 'CiviCRM setting Spec', 'All');
     CRM_Core_BAO_Cache::setItem($data, 'CiviCRM setting Specs', 'settingsMetadata__');
     $fields = $this->callAPISuccess('setting', 'getfields', array('filters' => array('group_name' => 'Test Settings')));
     $this->assertArrayHasKey('test_key', $fields['values']);
     $this->callAPISuccess('setting', 'create', array('test_key' => 'keyset'));
     $result = $this->callAPISuccess('setting', 'getvalue', array('name' => 'test_key', 'group' => 'Test Settings'));
     $this->assertEquals('keyset', $result);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:16,代码来源:SettingTest.php


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