From 3550b6a75a21e547b44ab52026a18d4770d00356 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 27 Apr 2020 19:58:26 +0200 Subject: [PATCH] allow different theme during install --- Application/ApplicationManager.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Application/ApplicationManager.php b/Application/ApplicationManager.php index 6d2c01c22..bf68f7e9c 100644 --- a/Application/ApplicationManager.php +++ b/Application/ApplicationManager.php @@ -88,6 +88,7 @@ final class ApplicationManager * * @param string $source Source of the application * @param string $destination Destination of the application + * @param string $theme Theme * * @return void * @@ -96,8 +97,9 @@ final class ApplicationManager * * @since 1.0.0 */ - public function install(string $source, string $destination) : void + public function install(string $source, string $destination, string $theme = 'Default') : void { + $destination = \rtrim($destination, '\\/'); if (!\file_exists($source) || \file_exists($destination)) { return; } @@ -106,8 +108,23 @@ final class ApplicationManager $this->applications[$app->getInternalName()] = $app; $this->installFiles($source, $destination); - $this->installTheme($destination, 'Akebi'); + $this->installTheme($destination, $theme); $this->installFromModules($app); + + $files = Directory::list($destination); + foreach ($files as $file) { + if (!\is_file($destination . '/' . $file)) { + continue; + } + + $content = \file_get_contents($destination . '/' . $file); + + if ($content === false) { + continue; + } + + \file_put_contents($destination . '/' . $file, \str_replace('{APPNAME}', \basename($destination), $content)); + } } /**