From 54e6796cbebe1f668c1b1ac1a14fff8aef89f349 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos <1697880+AngelFQC@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:22:23 -0500 Subject: [PATCH] Internal: Migration: Remove stylesheets ad theme settings + move var/theme/* to var/themes - refs BT#21621 --- .../Schema/V200/Version20240704185300.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/CoreBundle/Migrations/Schema/V200/Version20240704185300.php diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20240704185300.php b/src/CoreBundle/Migrations/Schema/V200/Version20240704185300.php new file mode 100644 index 00000000000..af64c29be07 --- /dev/null +++ b/src/CoreBundle/Migrations/Schema/V200/Version20240704185300.php @@ -0,0 +1,48 @@ +addSql("DELETE FROM settings WHERE variable IN ('stylesheets', 'theme')"); + + $kernel = $this->container->get('kernel'); + $rootPath = $kernel->getProjectDir(); + + $themeDirectory = $rootPath.'/var/theme'; + $themesDirectory = $rootPath.'/var/themes'; + + $finder = new Finder(); + $filesystem = new Filesystem(); + + $finder->directories()->in($themeDirectory)->depth('== 0'); + + foreach ($finder as $entry) { + if ($entry->isDir()) { + error_log( + sprintf( + "Moving theme directory: %s %s", + $entry->getRealPath(), + $themesDirectory.'/' + ) + ); + $filesystem->rename($entry->getRealPath(), $themesDirectory.'/'.$entry->getRelativePathname()); + } + } + } +} \ No newline at end of file