18
18
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
19
19
* @license BSD, see LICENSE_FASTLY_CDN.txt
20
20
*/
21
+
21
22
namespace Fastly \Cdn \Observer ;
22
23
23
24
use Fastly \Cdn \Helper \AutomaticCompression ;
@@ -81,7 +82,8 @@ public function __construct(
81
82
RequestInterface $ request ,
82
83
AutomaticCompression $ automaticCompressionHelper ,
83
84
ManagerInterface $ messageManager
84
- ) {
85
+ )
86
+ {
85
87
$ this ->moduleManager = $ manager ;
86
88
$ this ->statisticRepo = $ statisticRepository ;
87
89
$ this ->statistic = $ statistic ;
@@ -101,7 +103,7 @@ public function execute(Observer $observer) // @codingStandardsIgnoreLine - unus
101
103
if ($ this ->moduleManager ->isEnabled (Statistic::FASTLY_MODULE_NAME ) == false ) {
102
104
return ;
103
105
}
104
-
106
+ $ changedPaths = $ observer -> getChangedPaths ();
105
107
$ isServiceValid = $ this ->statistic ->isApiKeyValid ();
106
108
$ stat = $ this ->statisticRepo ->getStatByAction (Statistic::FASTLY_CONFIGURATION_FLAG );
107
109
@@ -116,7 +118,9 @@ public function execute(Observer $observer) // @codingStandardsIgnoreLine - unus
116
118
117
119
try {
118
120
$ 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
+ ) {
120
124
$ automaticCompression = $ configurationGroups ['full_page_cache ' ]['groups ' ]['fastly ' ]['groups ' ]['fastly_image_optimization_configuration ' ]['fields ' ]['automatic_compression ' ]['value ' ];
121
125
$ this ->automaticCompressionHelper ->updateVclSnippet ($ automaticCompression );
122
126
}
0 commit comments