Skip to content

Commit

Permalink
[TASK] Cleanup install service
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed Aug 12, 2018
1 parent 21d424b commit 4a6b07e
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions Classes/Service/InstallService.php
Expand Up @@ -77,9 +77,7 @@ private function createConfigurationFile($filename)
{
$absFilename = GeneralUtility::getFileAbsFileName($filename);
if (file_exists($absFilename)) {
/**
* Add Flashmessage that there is already an configuration file and we are not going to override this.
*/
// Add Flashmessage that there is already an configuration file and we are not going to override this.
$flashMessage = GeneralUtility::makeInstance(
FlashMessage::class,
'There is already an ' . $filename . ' configuration file in the root directory, '
Expand All @@ -92,20 +90,20 @@ private function createConfigurationFile($filename)
$this->addFlashMessage($flashMessage);
return;
}
$filecontent = GeneralUtility::getUrl(ExtensionManagementUtility::extPath(self::EXT_KEY) . '/Configuration/Server/_' . $filename);
GeneralUtility::writeFile($absFilename, $filecontent, true);

/**
* Add Flashmessage that the example configuration file was placed in the root directory
*/
$flashMessage = GeneralUtility::makeInstance(
FlashMessage::class,
'For securing configuration files and optimization purposes an example ' . $filename . ' file was placed in your root directory.',
'Webserver coniguration file "' . $filename . '" was placed in the root directory.',
FlashMessage::OK,
true
);
$this->addFlashMessage($flashMessage);
$filecontent = GeneralUtility::getUrl(ExtensionManagementUtility::extPath(self::EXT_KEY) . '/Configuration/Server/_' . $filename);
if ($filecontent && is_string($filecontent)) {
GeneralUtility::writeFile($absFilename, $filecontent, true);
// Add Flashmessage that the example configuration file was placed in the root directory
$flashMessage = GeneralUtility::makeInstance(
FlashMessage::class,
'For securing configuration files and optimization purposes an example ' . $filename . ' file was placed in your root directory.',
'Webserver coniguration file "' . $filename . '" was placed in the root directory.',
FlashMessage::OK,
true
);
$this->addFlashMessage($flashMessage);
}
}

/**
Expand All @@ -115,10 +113,8 @@ private function createConfigurationFile($filename)
*/
public function addFlashMessage(FlashMessage $flashMessage)
{
if ($flashMessage) {
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($this->messageQueueByIdentifier);
$flashMessageQueue->enqueue($flashMessage);
}
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($this->messageQueueByIdentifier);
$flashMessageQueue->enqueue($flashMessage);
}
}

0 comments on commit 4a6b07e

Please sign in to comment.