From f99a1c6bd087f029b0c4051605d5c6fe793b5243 Mon Sep 17 00:00:00 2001 From: Chris Garaffa Date: Wed, 20 Dec 2023 10:35:04 -0500 Subject: [PATCH] Use the deleted file list to remove old files after installation --- admin/configure.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/admin/configure.php b/admin/configure.php index 1cc29c5..d672982 100644 --- a/admin/configure.php +++ b/admin/configure.php @@ -55,6 +55,14 @@ function civicrm_extract_code(string $adminPath) { $archive = new Joomla\Archive\Archive(); $archive->extract($archivename, $extractdir); } + + $deletedFilesList = json_decode(file_get_contents($adminPath . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'deleted-files-list.json')); + foreach ($deletedFilesList as $deletedFile) { + $filePath = $adminPath . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . $deletedFile; + if (file_exists($filePath)) { + unlink($filePath); + } + } } function civicrm_main() {