From f5a480c72ee7aeecede6cef09121348646b71a5d Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 6 Mar 2020 13:41:03 +0200 Subject: [PATCH] Added `MediaTrait::freeMedia()` method to free media (and memory) --- CHANGELOG.md | 6 ++++++ system/src/Grav/Common/Media/Traits/MediaTrait.php | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd786baa8..c03b23024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.0-rc.8 +## mm/dd/2020 + +1. [](#bugfix) + * Added `MediaTrait::freeMedia()` method to free media (and memory) + # v1.7.0-rc.7 ## 03/05/2020 diff --git a/system/src/Grav/Common/Media/Traits/MediaTrait.php b/system/src/Grav/Common/Media/Traits/MediaTrait.php index 498a45202..e3bb9e6e4 100644 --- a/system/src/Grav/Common/Media/Traits/MediaTrait.php +++ b/system/src/Grav/Common/Media/Traits/MediaTrait.php @@ -108,6 +108,11 @@ trait MediaTrait return $this; } + protected function freeMedia() + { + $this->media = null; + } + /** * Clear media cache. */ @@ -117,7 +122,7 @@ trait MediaTrait $cacheKey = md5('media' . $this->getCacheKey()); $cache->delete($cacheKey); - $this->media = null; + $this->freeMedia(); } /**