/**
  * Detail configuration of Image Magick and Graphics Magick settings
  * depending on main values.
  *
  * "Configuration presets" in install tool is not type safe, so value
  * comparisons here are not type safe too, to not trigger changes to
  * LocalConfiguration again.
  *
  * @return void
  */
 protected function setImageMagickDetailSettings()
 {
     $changedValues = array();
     try {
         $currentIm5Value = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_version_5');
     } catch (\RuntimeException $e) {
         $currentIm5Value = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_version_5');
     }
     try {
         $currentImMaskValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_mask_temp_ext_gif');
     } catch (\RuntimeException $e) {
         $currentImMaskValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_mask_temp_ext_gif');
     }
     try {
         $currentIm5EffectsValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_v5effects');
     } catch (\RuntimeException $e) {
         $currentIm5EffectsValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_v5effects');
     }
     if ((string) $currentIm5Value !== '') {
         if ($currentImMaskValue != 1) {
             $changedValues['GFX/im_mask_temp_ext_gif'] = 1;
         }
         if ($currentIm5Value === 'gm') {
             if ($currentIm5EffectsValue != -1) {
                 $changedValues['GFX/im_v5effects'] = -1;
             }
         }
     }
     if (!empty($changedValues)) {
         $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($changedValues);
         $this->throwRedirectException();
     }
 }
 /**
  * Detail configuration of Image Magick and Graphics Magick settings
  * depending on main values.
  *
  * "Configuration presets" in install tool is not type safe, so value
  * comparisons here are not type safe too, to not trigger changes to
  * LocalConfiguration again.
  *
  * @return void
  */
 protected function setImageMagickDetailSettings()
 {
     $changedValues = array();
     try {
         $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor');
     } catch (\RuntimeException $e) {
         $currentProcessorValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor');
     }
     try {
         $currentProcessorMaskValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng');
     } catch (\RuntimeException $e) {
         $currentProcessorMaskValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng');
     }
     try {
         $currentProcessorEffectsValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_effects');
     } catch (\RuntimeException $e) {
         $currentProcessorEffectsValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_effects');
     }
     if ((string) $currentProcessorValue !== '') {
         if ($currentProcessorMaskValue != 0) {
             $changedValues['GFX/processor_allowTemporaryMasksAsPng'] = 0;
         }
         if ($currentProcessorValue === 'GraphicsMagick') {
             if ($currentProcessorEffectsValue != -1) {
                 $changedValues['GFX/processor_effects'] = -1;
             }
         }
     }
     if (!empty($changedValues)) {
         $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($changedValues);
         $this->throwRedirectException();
     }
 }
예제 #3
0
 /**
  * Configure selected feature presets to be active
  *
  * @return \TYPO3\CMS\Install\Status\StatusInterface
  */
 protected function activate()
 {
     $configurationValues = $this->featureManager->getConfigurationForSelectedFeaturePresets($this->postValues['values']);
     if (!empty($configurationValues)) {
         $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
         /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
         $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Configuration written');
         $messageBody = array();
         foreach ($configurationValues as $configurationKey => $configurationValue) {
             $messageBody[] = '\'' . $configurationKey . '\' => \'' . $configurationValue . '\'';
         }
         $message->setMessage(implode(LF, $messageBody));
     } else {
         /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
         $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
         $message->setTitle('No configuration change selected');
     }
     return $message;
 }
 /**
  * @test
  */
 public function setLocalConfigurationValuesByPathValuePairsSetsPathValuePairs()
 {
     $currentLocalConfiguration = array('notChanged' => 23, 'toUpdate' => 'notUpdated');
     $expectedConfiguration = array('notChanged' => 23, 'toUpdate' => 'updated', 'new' => 'new');
     $this->createSubjectWithMockedMethods(array('isValidLocalConfigurationPath', 'getLocalConfiguration', 'writeLocalConfiguration'));
     $this->subject->expects($this->any())->method('isValidLocalConfigurationPath')->will($this->returnValue(true));
     $this->subject->expects($this->once())->method('getLocalConfiguration')->will($this->returnValue($currentLocalConfiguration));
     $this->subject->expects($this->once())->method('writeLocalConfiguration')->with($expectedConfiguration);
     $pairs = array('toUpdate' => 'updated', 'new' => 'new');
     $this->subject->setLocalConfigurationValuesByPathValuePairs($pairs);
 }
 /**
  * Migrate old Install Tool Wizard "done"-settings to new class names
  * this happens usually when an existing 6.0/6.1 has called the TceformsUpdateWizard wizard
  * and has written Tx_Install_Updates_File_TceformsUpdateWizard in TYPO3's LocalConfiguration.php
  *
  * @return void
  */
 protected function migrateOldInstallWizardDoneSettingsToNewClassNames()
 {
     $classNamesToConvert = array();
     $localConfiguration = $this->configurationManager->getLocalConfiguration();
     // check for wizards that have been run already and don't start with TYPO3...
     if (isset($localConfiguration['INSTALL']['wizardDone']) && is_array($localConfiguration['INSTALL']['wizardDone'])) {
         $classNames = array_keys($localConfiguration['INSTALL']['wizardDone']);
         foreach ($classNames as $className) {
             if (!GeneralUtility::isFirstPartOfStr($className, 'TYPO3')) {
                 $classNamesToConvert[] = $className;
             }
         }
     }
     if (!count($classNamesToConvert)) {
         return;
     }
     $migratedClassesMapping = array('Tx_Install_Updates_File_TceformsUpdateWizard' => 'TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard');
     $migratedSettings = array();
     $settingsToRemove = array();
     foreach ($classNamesToConvert as $oldClassName) {
         if (isset($migratedClassesMapping[$oldClassName])) {
             $newClassName = $migratedClassesMapping[$oldClassName];
         } else {
             continue;
         }
         $oldValue = NULL;
         $newValue = NULL;
         try {
             $oldValue = $this->configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone/' . $oldClassName);
         } catch (\RuntimeException $e) {
             // The old configuration does not exist
             continue;
         }
         try {
             $newValue = $this->configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone/' . $newClassName);
         } catch (\RuntimeException $e) {
             // The new configuration does not exist yet
         }
         if ($newValue === NULL) {
             // Migrate the old configuration to the new one
             $migratedSettings['INSTALL/wizardDone/' . $newClassName] = $oldValue;
         }
         $settingsToRemove[] = 'INSTALL/wizardDone/' . $oldClassName;
     }
     if (count($migratedSettings)) {
         $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($migratedSettings);
     }
     $this->configurationManager->removeLocalConfigurationKeysByPath($settingsToRemove);
     if (count($migratedSettings) || count($settingsToRemove)) {
         $this->throwRedirectException();
     }
 }
예제 #6
0
 /**
  * Migrate the configuration value thumbnails_png to a boolean value.
  *
  * @return void
  */
 protected function migrateThumbnailsPngSetting()
 {
     $changedValues = [];
     try {
         $currentThumbnailsPngValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/thumbnails_png');
     } catch (\RuntimeException $e) {
         $currentThumbnailsPngValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/thumbnails_png');
     }
     if (is_int($currentThumbnailsPngValue) && $currentThumbnailsPngValue > 0) {
         $changedValues['GFX/thumbnails_png'] = true;
     }
     if (!empty($changedValues)) {
         $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($changedValues);
         $this->throwRedirectException();
     }
 }
예제 #7
0
 /**
  * Set new configuration values in LocalConfiguration.php
  *
  * @param array $pathValuePairs
  * @return void
  */
 protected function setLocalConfigurationValues(array $pathValuePairs)
 {
     // Get the template file
     $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'WriteToLocalConfControl.html');
     if (\TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValuesByPathValuePairs($pathValuePairs)) {
         // Get the template part from the file
         $template = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###CONTINUE###');
         // Get the subpart for messages
         $messagesSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###MESSAGES###');
         $messages = array();
         foreach ($this->messages as $message) {
             // Define the markers content
             $messagesMarkers['message'] = $message;
             // Fill the markers in the subpart
             $messages[] = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($messagesSubPart, $messagesMarkers, '###|###', TRUE, FALSE);
         }
         // Substitute the subpart for messages
         $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($template, '###MESSAGES###', implode(LF, $messages));
         // Define the markers content
         $markers = array('header' => 'Writing configuration', 'action' => $this->action, 'label' => 'Click to continue...');
         // Fill the markers
         $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($content, $markers, '###|###', TRUE, FALSE);
         $this->outputExitBasedOnStep($content);
     } else {
         // Get the template part from the file
         $template = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###NOCHANGE###');
         // Define the markers content
         $markers = array('header' => 'Writing configuration', 'message' => 'No values were changed, so nothing is updated!', 'action' => $this->action, 'label' => 'Click to continue...');
         // Fill the markers
         $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markers, '###|###', TRUE, FALSE);
         $this->outputExitBasedOnStep($content);
     }
 }