@@ -28,6 +28,18 @@ class Config implements ConfigInterface
28
28
/** Configuration path for session cache limiter */
29
29
const PARAM_SESSION_CACHE_LIMITER = 'session/cache_limiter ' ;
30
30
31
+ /** Configuration path for session garbage collection probability */
32
+ const PARAM_SESSION_GC_PROBABILITY = 'session/gc_probability ' ;
33
+
34
+ /** Configuration path for session garbage collection divisor */
35
+ const PARAM_SESSION_GC_DIVISOR = 'session/gc_divisor ' ;
36
+
37
+ /**
38
+ * Configuration path for session garbage collection max lifetime.
39
+ * The number of seconds after which data will be seen as 'garbage'.
40
+ */
41
+ const PARAM_SESSION_GC_MAXLIFETIME = 'session/gc_maxlifetime ' ;
42
+
31
43
/** Configuration path for cookie domain */
32
44
const XML_PATH_COOKIE_DOMAIN = 'web/cookie/cookie_domain ' ;
33
45
@@ -102,6 +114,7 @@ class Config implements ConfigInterface
102
114
* @param string $scopeType
103
115
* @param string $lifetimePath
104
116
* @SuppressWarnings(PHPMD.NPathComplexity)
117
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
105
118
*/
106
119
public function __construct (
107
120
\Magento \Framework \ValidatorFactory $ validatorFactory ,
@@ -149,6 +162,30 @@ public function __construct(
149
162
$ this ->setOption ('session.cache_limiter ' , $ cacheLimiter );
150
163
}
151
164
165
+ /**
166
+ * Session garbage collection probability
167
+ */
168
+ $ gcProbability = $ deploymentConfig ->get (self ::PARAM_SESSION_GC_PROBABILITY );
169
+ if ($ gcProbability ) {
170
+ $ this ->setOption ('session.gc_probability ' , $ gcProbability );
171
+ }
172
+
173
+ /**
174
+ * Session garbage collection divisor
175
+ */
176
+ $ gcDivisor = $ deploymentConfig ->get (self ::PARAM_SESSION_GC_DIVISOR );
177
+ if ($ gcDivisor ) {
178
+ $ this ->setOption ('session.gc_divisor ' , $ gcDivisor );
179
+ }
180
+
181
+ /**
182
+ * Session garbage collection max lifetime
183
+ */
184
+ $ gcMaxlifetime = $ deploymentConfig ->get (self ::PARAM_SESSION_GC_MAXLIFETIME );
185
+ if ($ gcMaxlifetime ) {
186
+ $ this ->setOption ('session.gc_maxlifetime ' , $ gcMaxlifetime );
187
+ }
188
+
152
189
/**
153
190
* Cookie settings: lifetime, path, domain, httpOnly. These govern settings for the session cookie.
154
191
*/
0 commit comments