From 9fe8ce1e4c510edc303b18b49b97a6d99c1cdd00 Mon Sep 17 00:00:00 2001 From: Ro Date: Wed, 6 Oct 2021 13:17:42 -0700 Subject: [PATCH] #56 moves global assets from theme if not present in public dir --- brain/data/Render.inc.php | 24 +++++++++++++++++++ .../global/{the-logo.svg => fipamo-logo.svg} | 0 2 files changed, 24 insertions(+) rename content/themes/fipamo-default/assets/images/global/{the-logo.svg => fipamo-logo.svg} (100%) diff --git a/brain/data/Render.inc.php b/brain/data/Render.inc.php index a3aae82..8c14b9c 100644 --- a/brain/data/Render.inc.php +++ b/brain/data/Render.inc.php @@ -26,6 +26,30 @@ class Render $settings["global"]["base_url"] . $settings["global"]["background"], "baseURL" => $settings["global"]["base_url"], ]; + //move global theme image assets to public folder + foreach ( + new DirectoryIterator( + "../content/themes/" . $this->theme . "/assets/images/global/" + ) + as $file + ) { + if ($file->isDot()) { + continue; + } + if (!is_file("../public/assets/images/global/" . $file->getFileName())) { + copy( + "../content/themes/" . + $this->theme . + "/assets/images/global/" . + $file->getFileName(), + "../public/assets/images/global/" . $file->getFileName() + ); + } else { + //image is already there, so chill + } + //print $file->getFilename() . "\n"; + } + //copy current theme assets to public if (is_file("../public/assets/css/base.css")) { unlink("../public/assets/css/base.css"); diff --git a/content/themes/fipamo-default/assets/images/global/the-logo.svg b/content/themes/fipamo-default/assets/images/global/fipamo-logo.svg similarity index 100% rename from content/themes/fipamo-default/assets/images/global/the-logo.svg rename to content/themes/fipamo-default/assets/images/global/fipamo-logo.svg