From 42e382c041991266b4713a9b38dbaf1cac679e82 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 23 Jul 2019 10:36:54 +1000 Subject: [PATCH] Update CiviHR code to be CiviCRM 5.16 complient and convert CiviHR cache group to be standard Civi::cache style --- .../CRM/Hrjobcontract/BAO/HRJobContractRevision.php | 1 - hrjobcontract/CRM/Hrjobcontract/BAO/HRJobDetails.php | 1 - hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHealth.php | 1 - hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHour.php | 1 - hrjobcontract/CRM/Hrjobcontract/BAO/HRJobLeave.php | 1 - hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPay.php | 1 - hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPension.php | 1 - hrjobcontract/CRM/Hrjobcontract/BAO/HRJobRole.php | 1 - hrui/CRM/Core/BAO/Navigation.php | 4 ++-- uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Info.php | 4 ++-- .../config/container/container.xml | 12 ++++++++++++ 11 files changed, 16 insertions(+), 12 deletions(-) diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobContractRevision.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobContractRevision.php index 5882f849763..342a8a3965f 100755 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobContractRevision.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobContractRevision.php @@ -174,7 +174,6 @@ static function importableFields($contactType = 'HRJobContractRevision', $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; diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobDetails.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobDetails.php index d77ca60868b..1dc145d46be 100644 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobDetails.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobDetails.php @@ -251,7 +251,6 @@ static function importableFields($contactType = 'HRJobDetails', //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; diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHealth.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHealth.php index 43695b04f65..83fbce8580a 100644 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHealth.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHealth.php @@ -120,7 +120,6 @@ static function importableFields($contactType = 'HRJobHealth', $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; diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHour.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHour.php index 56feaac5ea9..8ad469288a4 100644 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHour.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobHour.php @@ -111,7 +111,6 @@ static function importableFields($contactType = 'HRJobHour', $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; diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobLeave.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobLeave.php index f27ac050844..063c6395ee5 100644 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobLeave.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobLeave.php @@ -95,7 +95,6 @@ static function importableFields($contactType = 'HRJobLeave', //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) { diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPay.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPay.php index 7a79d95dab4..5f8cb5cd733 100644 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPay.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPay.php @@ -95,7 +95,6 @@ static function importableFields($contactType = 'HRJobPay', $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; diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPension.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPension.php index dc23d2f8607..cc8069c38b4 100644 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPension.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobPension.php @@ -115,7 +115,6 @@ static function importableFields($contactType = 'HRJobPension', $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; diff --git a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobRole.php b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobRole.php index a122898534c..06bb9b4e96a 100644 --- a/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobRole.php +++ b/hrjobcontract/CRM/Hrjobcontract/BAO/HRJobRole.php @@ -73,7 +73,6 @@ static function importableFields($contactType = 'HRJobRole', $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; diff --git a/hrui/CRM/Core/BAO/Navigation.php b/hrui/CRM/Core/BAO/Navigation.php index 7fc88acc657..edcc6237e43 100755 --- a/hrui/CRM/Core/BAO/Navigation.php +++ b/hrui/CRM/Core/BAO/Navigation.php @@ -166,7 +166,7 @@ public static function getNavigationList() { $config = CRM_Core_Config::singleton(); // check if we can retrieve from database cache - $navigations = CRM_Core_BAO_Cache::getItem('navigation', $cacheKeyString); + $navigations = Civi::cache('navigation')->get($cacheKeyString); if (!$navigations) { $domainID = CRM_Core_Config::domainID(); @@ -187,7 +187,7 @@ public static function getNavigationList() { $navigations = array(); self::_getNavigationLabel($pidGroups[''], $navigations); - CRM_Core_BAO_Cache::setItem($navigations, 'navigation', $cacheKeyString); + Civi::cache('navigation')->set($cacheKeyString, $navigations); } return $navigations; } diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Info.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Info.php index 6ef5b907341..3c14cd3010f 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Info.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Info.php @@ -9,12 +9,12 @@ class CRM_HRCore_Info { */ public static function getVersion() { - $version = CRM_Core_BAO_Cache::getItem('HRCore_Info', 'version'); + $version = Civi::cache('HRCore_Info')->get('version'); if (empty($version)) { $info = CRM_Extension_Info::loadFromFile(__DIR__ . '/../../info.xml'); $version = $info->version; - CRM_Core_BAO_Cache::setItem($version, 'HRCore_Info', 'version'); + Civi::cache('HRCore_Info')->set('version', $version); } return $version; diff --git a/uk.co.compucorp.civicrm.hrcore/config/container/container.xml b/uk.co.compucorp.civicrm.hrcore/config/container/container.xml index 3055b64c30b..aac0cbd3104 100644 --- a/uk.co.compucorp.civicrm.hrcore/config/container/container.xml +++ b/uk.co.compucorp.civicrm.hrcore/config/container/container.xml @@ -34,6 +34,18 @@ class="CRM_HRCore_CMSData_Role_RoleServiceInterface" /> + + + HRCore_Info + + *memory* + SqlGroup + ArrayCache + + fast + + %civihr.connection_timeout%