/** * 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(); } }
/** * 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(); } }
/** * 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(); } }
/** * @test */ public function getDefaultConfigurationValueByPathReturnsCorrectValue() { $this->createSubjectWithMockedMethods(array('getDefaultConfiguration')); $this->subject->expects($this->once())->method('getDefaultConfiguration')->will($this->returnValue(array('path' => 'value'))); $this->assertSame('value', $this->subject->getDefaultConfigurationValueByPath('path')); }