From 43220abbb09c1970728ef8a7f79e6f220e5d228b Mon Sep 17 00:00:00 2001 From: Bob Olde Hampsink Date: Thu, 10 Jan 2019 11:24:10 +0100 Subject: [PATCH] Fixed issue where global set sources weren't linked because they were cached --- CHANGELOG.md | 1 + src/DataTypes/GlobalSetDataType.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ded1ff6a..5c8d50f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 4.1.1 - 2019-01-08 ### Fixed - Fixed "assign user group" permissions not being exported +- Fixed issue where global set sources weren't linked because they were cached ## 4.1.0 - 2018-11-19 ### Added diff --git a/src/DataTypes/GlobalSetDataType.php b/src/DataTypes/GlobalSetDataType.php index a1021d00..a426b08e 100644 --- a/src/DataTypes/GlobalSetDataType.php +++ b/src/DataTypes/GlobalSetDataType.php @@ -35,4 +35,18 @@ public function getRecords(): array { return Craft::$app->globals->getAllSets(); } + + /** + * Reset craft global sets cache using reflection. + */ + public function afterImport() + { + $obj = Craft::$app->globals; + $refObject = new \ReflectionObject($obj); + if ($refObject->hasProperty('_allGlobalSets')) { + $refProperty1 = $refObject->getProperty('_allGlobalSets'); + $refProperty1->setAccessible(true); + $refProperty1->setValue($obj, null); + } + } }