File tree Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,12 @@ class Config extends \Magento\PageCache\Model\Config
331331 const XML_FASTLY_IMAGE_OPTIMIZATIONS
332332 = 'system/full_page_cache/fastly/fastly_image_optimization_configuration/image_optimizations ' ;
333333
334+ /**
335+ * XML path to image optimizations flag forced
336+ */
337+ const XML_FASTLY_IMAGE_OPTIMIZATIONS_FORCED
338+ = 'system/full_page_cache/fastly/fastly_image_optimization_configuration/image_optimizations_forced ' ;
339+
334340 /**
335341 * XML path to automatic compression flag
336342 */
@@ -828,6 +834,10 @@ public function getGeoIpRedirectMapping()
828834 */
829835 public function isImageOptimizationEnabled ()
830836 {
837+ if ($ this ->_scopeConfig ->isSetFlag (self ::XML_FASTLY_IMAGE_OPTIMIZATIONS_FORCED )) {
838+ return true ;
839+ }
840+
831841 if ($ this ->isFastlyEnabled () !== true ) {
832842 return false ;
833843 }
Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ private function isFastlyImageOptimizationEnabled()
7878 $ this ->isFastlyEnabled = false ;
7979 }
8080
81+ if ($ this ->_scopeConfig ->isSetFlag (Config::XML_FASTLY_IMAGE_OPTIMIZATIONS_FORCED )) {
82+ $ this ->isFastlyEnabled = true ;
83+ }
84+
8185 return $ this ->isFastlyEnabled ;
8286 }
8387
@@ -100,6 +104,10 @@ public function isForceLossyEnabled()
100104 $ this ->isForceLossyEnabled = false ;
101105 }
102106
107+ if ($ this ->_scopeConfig ->isSetFlag (Config::XML_FASTLY_IMAGE_OPTIMIZATIONS_FORCED )) {
108+ $ this ->isFastlyEnabled = true ;
109+ }
110+
103111 return $ this ->isForceLossyEnabled ;
104112 }
105113
Original file line number Diff line number Diff line change 496496 target="_blank">image optimization guide</a> for caveats and details.]]> </comment >
497497 <source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
498498 </field >
499+ <!-- ===============================================
500+ Force Enable Deep Image Optimization select field
501+ ================================================ -->
502+ <field id =" image_optimizations_forced" translate =" label comment" type =" select" sortOrder =" 20" showInDefault =" 1" showInWebsite =" 0" showInStore =" 0" >
503+ <label >Force Enable Deep Image Optimization</label >
504+ <comment ><![CDATA[ Use this to forcefully enable deep image optimisation on instances that are not connected to fastly, for use on test environments]]> </comment >
505+ <source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
506+ </field >
499507 <!-- ====================================================
500508 JPEG image quality input field
501509 ===================================================== -->
Original file line number Diff line number Diff line change 4545 </fastly_blocking >
4646 <fastly_image_optimization_configuration >
4747 <image_optimizations >0</image_optimizations >
48+ <image_optimizations_forced >0</image_optimizations_forced >
4849 <image_optimization_force_lossy >0</image_optimization_force_lossy >
4950 <image_optimization_image_quality >80</image_optimization_image_quality >
5051 <image_optimization_bg_color >1</image_optimization_bg_color >
You can’t perform that action at this time.
0 commit comments