Skip to content

Commit 880b1dc

Browse files
authored
Merge pull request #477 from favicode/issue/476
fix config save - image optimization #476
2 parents cdf380c + bc69c2f commit 880b1dc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: Observer/ConfigurationSave.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
1919
* @license BSD, see LICENSE_FASTLY_CDN.txt
2020
*/
21+
2122
namespace Fastly\Cdn\Observer;
2223

2324
use Fastly\Cdn\Helper\AutomaticCompression;
@@ -81,7 +82,8 @@ public function __construct(
8182
RequestInterface $request,
8283
AutomaticCompression $automaticCompressionHelper,
8384
ManagerInterface $messageManager
84-
) {
85+
)
86+
{
8587
$this->moduleManager = $manager;
8688
$this->statisticRepo = $statisticRepository;
8789
$this->statistic = $statistic;
@@ -101,7 +103,7 @@ public function execute(Observer $observer) // @codingStandardsIgnoreLine - unus
101103
if ($this->moduleManager->isEnabled(Statistic::FASTLY_MODULE_NAME) == false) {
102104
return;
103105
}
104-
106+
$changedPaths = $observer->getChangedPaths();
105107
$isServiceValid = $this->statistic->isApiKeyValid();
106108
$stat = $this->statisticRepo->getStatByAction(Statistic::FASTLY_CONFIGURATION_FLAG);
107109

@@ -116,7 +118,9 @@ public function execute(Observer $observer) // @codingStandardsIgnoreLine - unus
116118

117119
try {
118120
$configurationGroups = $this->request->getParam('groups');
119-
if (isset($configurationGroups['full_page_cache']['groups']['fastly']['groups']['fastly_image_optimization_configuration'])) {
121+
if (isset($configurationGroups['full_page_cache']['groups']['fastly']['groups']['fastly_image_optimization_configuration'])
122+
&& in_array('system/full_page_cache/fastly/fastly_image_optimization_configuration/automatic_compression', $changedPaths)
123+
) {
120124
$automaticCompression = $configurationGroups['full_page_cache']['groups']['fastly']['groups']['fastly_image_optimization_configuration']['fields']['automatic_compression']['value'];
121125
$this->automaticCompressionHelper->updateVclSnippet($automaticCompression);
122126
}

0 commit comments

Comments
 (0)