From 9f5a15f00ad268077bd32e679d060288e67c6ea7 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 29 Apr 2021 15:37:44 +0300 Subject: [PATCH] Updating a theme should always keep the custom files --- CHANGELOG.md | 2 ++ system/src/Grav/Common/GPM/Installer.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d88e74cb..655a5f951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ 1. [](#new) * Added `MediaUploadTrait::checkFileMetadata()` method +1. [](#improved) + * Updating a theme should always keep the custom files [getgrav/grav-plugin-admin#2135](https://github.com/getgrav/grav-plugin-admin/issues/2135) 1. [](#bugfix) * Fixed broken numeric language codes in Flex Pages [#3332](https://github.com/getgrav/grav/issues/3332) * Fixed broken `exif_imagetype()` twig function diff --git a/system/src/Grav/Common/GPM/Installer.php b/system/src/Grav/Common/GPM/Installer.php index 9cdea52aa..639240be6 100644 --- a/system/src/Grav/Common/GPM/Installer.php +++ b/system/src/Grav/Common/GPM/Installer.php @@ -135,7 +135,10 @@ class Installer } if (!$options['sophisticated']) { - if ($options['theme']) { + $isTheme = $options['theme'] ?? false; + // Make sure that themes are always being copied, even if option was not set! + $isTheme = $isTheme || preg_match('|/themes/[^/]+|ui', $install_path); + if ($isTheme) { self::copyInstall($extracted, $install_path); } else { self::moveInstall($extracted, $install_path);