allow different theme during install

This commit is contained in:
Dennis Eichhorn 2020-04-27 19:58:26 +02:00
parent 0420690853
commit 3550b6a75a

View File

@ -88,6 +88,7 @@ final class ApplicationManager
* *
* @param string $source Source of the application * @param string $source Source of the application
* @param string $destination Destination of the application * @param string $destination Destination of the application
* @param string $theme Theme
* *
* @return void * @return void
* *
@ -96,8 +97,9 @@ final class ApplicationManager
* *
* @since 1.0.0 * @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)) { if (!\file_exists($source) || \file_exists($destination)) {
return; return;
} }
@ -106,8 +108,23 @@ final class ApplicationManager
$this->applications[$app->getInternalName()] = $app; $this->applications[$app->getInternalName()] = $app;
$this->installFiles($source, $destination); $this->installFiles($source, $destination);
$this->installTheme($destination, 'Akebi'); $this->installTheme($destination, $theme);
$this->installFromModules($app); $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));
}
} }
/** /**