From 04aa3cdcc33366f70ddda6c854f08a7a12ed237b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sun, 13 Mar 2022 18:10:43 +1300 Subject: [PATCH] dev/core#3112 Clear caches to avoid error on upgrade There may be a better place for this - but at least here is is clear to the api call that can fail without it .... if the metadata cache is populated from an earlier version the table_name key may not exist & hence the api call fails with no table_name in the from clause --- CRM/Upgrade/Incremental/php/FiveFortySeven.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Upgrade/Incremental/php/FiveFortySeven.php b/CRM/Upgrade/Incremental/php/FiveFortySeven.php index ff2204c8c8..8e72dade90 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortySeven.php +++ b/CRM/Upgrade/Incremental/php/FiveFortySeven.php @@ -116,6 +116,9 @@ class CRM_Upgrade_Incremental_php_FiveFortySeven extends CRM_Upgrade_Incremental } CRM_Core_DAO::executeQuery("DELETE FROM civicrm_component WHERE name = 'CiviGrant'", [], TRUE, NULL, FALSE, FALSE); } + // Reload the civi cache here as 'table_name' may not be in the cached entities + // array generated in an earlier version retrieved via $cache->get('api4.entities.info', []); + Civi::cache('metadata')->flush(); // There are existing records which should be managed by `civigrant`. To assign ownership, we need // placeholders in `civicrm_extension` and `civicrm_managed`. -- 2.25.1