}
}
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity);
CRM_Core_DAO::executeQuery('DELETE FROM civicrm_acl_contact_cache WHERE contact_id = %1', array(1 => array($contactID, 'Integer')));
}
else {
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
}
}
CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $addToGroupID);
}
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
if ($editHook) {
CRM_Utils_Hook::post('edit', 'Profile', $contactID, $params);
CRM_Core_BAO_PrevNextCache::deleteItem();
}
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
}
/**
// reset the group contact cache for all group(s)
// if this group is being used as a smart group
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
CRM_Utils_Hook::post('create', 'GroupContact', $groupId, $contactIds);
// if this group is being used as a smart group
// @todo consider what to do here - it feels like we should either
// 1) just invalidate the specific group's cache(& perhaps any parents) & let cron do it's thing or
- // possibly clear this specific groups cache, or just call opportunisticCacheRefresh() - which would have the
+ // possibly clear this specific groups cache, or just call opportunisticCacheFlush() - which would have the
// same effect as the remove call. The reservation about that is that it is no more aggressive for the group that
// we know is altered than for all the others, or perhaps, more the point with it's parents & groups that use it in
// their criteria.
* This function should be called via the opportunistic or deterministic cache refresh function to make the intent
* clear.
*/
- protected static function refreshCaches() {
+ protected static function flushCaches() {
try {
$lock = self::getLockForRefresh();
}
* Sites that do not run the smart group clearing cron job should refresh the caches under an opportunistic mode, akin
* to a poor man's cron. The user session will be forced to wait on this so it is less desirable.
*/
- public static function opportunisticCacheRefresh() {
+ public static function opportunisticCacheFlush() {
if (Civi::settings()->get('smart_group_cache_refresh_mode') == 'opportunistic') {
- self::refreshCaches();
+ self::flushCaches();
}
}
*
* This function is appropriate to be called by system jobs & non-user sessions.
*/
- public static function deterministicCacheRefresh() {
+ public static function deterministicCacheFlush() {
if (self::smartGroupCacheTimeout() == 0) {
CRM_Core_DAO::executeQuery("TRUNCATE civicrm_group_contact_cache");
CRM_Core_DAO::executeQuery("
SET cache_date = null, refresh_date = null");
}
else {
- self::refreshCaches();
+ self::flushCaches();
}
}
$this->ajaxResponse += CRM_Contact_Form_Inline::renderFooter($this->_tableID);
}
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
}
}
$this->log();
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
$this->response();
}
echo CRM_Contact_BAO_Contact::getCountComponent('custom_' . $customGroupID, $contactId);
}
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
CRM_Utils_System::civiExit();
}
);
}
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
if ($contributionID) {
CRM_Utils_Hook::post('edit', 'Contribution', $contribution->id, $contribution);
$object = array($entityIdsAdded, $entityTable);
CRM_Utils_Hook::post('create', 'EntityTag', $tagId, $object);
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
return array(count($entityIds), $numEntitiesAdded, $numEntitiesNotAdded);
}
$object = array($entityIdsRemoved, $entityTable);
CRM_Utils_Hook::post('delete', 'EntityTag', $tagId, $object);
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
return array(count($entityIds), $numEntitiesRemoved, $numEntitiesNotRemoved);
}
$session = CRM_Core_Session::singleton();
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Participant', $participantBAO->id, $participantBAO);
CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
// reset the group contact cache since smart groups might be affected due to this
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
if ($id) {
if ($membership->status_id != $oldStatus) {
* @throws \API_Exception
*/
function civicrm_api3_job_group_cache_flush($params) {
- CRM_Contact_BAO_GroupContactCache::deterministicCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::deterministicCacheFlush();
return civicrm_api3_create_success();
}
array($deceased[0]->id, $deceased[1]->id, $deceased[2]->id),
$group->id
);
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
$this->assertCacheNotRefreshed($deceased, $group);
}
$group->find(TRUE);
Civi::$statics['CRM_Contact_BAO_GroupContactCache']['is_refresh_init'] = FALSE;
sleep(1);
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
$this->assertCacheRefreshed($group);
}
$this->callAPISuccess('Setting', 'create', array('smart_group_cache_refresh_mode' => 'deterministic'));
$this->callAPISuccess('Contact', 'create', array('id' => $deceased[0]->id, 'is_deceased' => 0));
$this->makeCacheStale($group);
- CRM_Contact_BAO_GroupContactCache::opportunisticCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
$this->assertCacheNotRefreshed($deceased, $group);
$this->callAPISuccess('Setting', 'create', array('smart_group_cache_refresh_mode' => 'opportunistic'));
}
$this->callAPISuccess('Setting', 'create', array('smart_group_cache_refresh_mode' => 'deterministic'));
$this->callAPISuccess('Contact', 'create', array('id' => $deceased[0]->id, 'is_deceased' => 0));
$this->makeCacheStale($group);
- CRM_Contact_BAO_GroupContactCache::deterministicCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::deterministicCacheFlush();
$this->assertCacheRefreshed($group);
$this->callAPISuccess('Setting', 'create', array('smart_group_cache_refresh_mode' => 'opportunistic'));
}
list($group, $living, $deceased) = $this->setupSmartGroup();
$this->callAPISuccess('Setting', 'create', array('smart_group_cache_refresh_mode' => 'deterministic'));
$this->callAPISuccess('Contact', 'create', array('id' => $deceased[0]->id, 'is_deceased' => 0));
- CRM_Contact_BAO_GroupContactCache::deterministicCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::deterministicCacheFlush();
$this->assertCacheNotRefreshed($deceased, $group);
$this->callAPISuccess('Setting', 'create', array('smart_group_cache_refresh_mode' => 'opportunistic'));
}
$this->callAPISuccess('Setting', 'create', array('smart_group_cache_refresh_mode' => 'opportunistic'));
$this->callAPISuccess('Contact', 'create', array('id' => $deceased[0]->id, 'is_deceased' => 0));
$this->makeCacheStale($group);
- CRM_Contact_BAO_GroupContactCache::deterministicCacheRefresh();
+ CRM_Contact_BAO_GroupContactCache::deterministicCacheFlush();
$this->assertCacheRefreshed($group);
}