Skip to content

Commit

Permalink
Convert custom data and CiviCRM Search PrevNextCache search groups
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Jun 10, 2019
1 parent c1653b4 commit 6272ddf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CRM/Campaign/Selector/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function buildPrevNextCache($sort) {

if (Civi::service('prevnext') instanceof CRM_Core_PrevNextCache_Sql) {
// SQL-backed prevnext cache uses an extra record for pruning the cache.
CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
Civi::cache('prevNextCache')->set($cacheKey, $cacheKey);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = self::C

if (Civi::service('prevnext') instanceof CRM_Core_PrevNextCache_Sql) {
// SQL-backed prevnext cache uses an extra record for pruning the cache.
CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
Civi::cache('prevNextCache')->set($cacheKey, $cacheKey);
}
}

Expand Down
3 changes: 0 additions & 3 deletions CRM/Core/BAO/Cache/Psr16.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,6 @@ public static function clearDBCache() {
*/
public static function getLegacyGroups() {
return [
// Core
'CiviCRM Search PrevNextCache',
'custom data',

// Universe

Expand Down
5 changes: 3 additions & 2 deletions CRM/Core/BAO/CustomGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1816,10 +1816,11 @@ public static function formatGroupTree(&$groupTree, $groupCount = 1, &$form = NU

// retrieve qf key from url
$qfKey = CRM_Utils_Request::retrieve('qf', 'String');
$cache = Civi::cache('customData');

// fetch submitted custom field values later use to set as a default values
if ($qfKey) {
$submittedValues = CRM_Core_BAO_Cache::getItem('custom data', $qfKey);
$submittedValues = $cache->get($qfKey);
}

foreach ($groupTree as $key => $value) {
Expand Down Expand Up @@ -1878,7 +1879,7 @@ public static function formatGroupTree(&$groupTree, $groupCount = 1, &$form = NU
if (count($formValues)) {
$qf = $form->get('qfKey');
$form->assign('qfKey', $qf);
CRM_Core_BAO_Cache::setItem($formValues, 'custom data', $qf);
$cache->set($qf, $formValues);
}

// hack for field type File
Expand Down
3 changes: 2 additions & 1 deletion CRM/Core/BAO/PrevNextCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,10 @@ public static function cleanupCache() {
AND c.created_date < date_sub( NOW( ), INTERVAL %2 day )
";
$params = [
1 => ['CiviCRM Search PrevNextCache', 'String'],
1 => [CRM_Core_BAO_Cache::cleanKey('CiviCRM Search PrevNextCache'), 'String'],
2 => [$cacheTimeIntervalDays, 'Integer'],
];
print_r(json_encode($params));
CRM_Core_DAO::executeQuery($sql, $params);
}

Expand Down
2 changes: 2 additions & 0 deletions Civi/Core/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ public function createContainer() {
'fields' => 'contact fields',
'navigation' => 'navigation',
'groups' => 'contact groups',
'prevNextCache' => 'CiviCRM Search PrevNextCache',
'customData' => 'custom data',
];
foreach ($basicCaches as $cacheSvc => $cacheGrp) {
$container->setDefinition("cache.{$cacheSvc}", new Definition(
Expand Down

0 comments on commit 6272ddf

Please sign in to comment.