@@ -28,6 +28,18 @@ class Config implements ConfigInterface
2828 /** Configuration path for session cache limiter */
2929 const PARAM_SESSION_CACHE_LIMITER = 'session/cache_limiter ' ;
3030
31+ /** Configuration path for session garbage collection probability */
32+ private const PARAM_SESSION_GC_PROBABILITY = 'session/gc_probability ' ;
33+
34+ /** Configuration path for session garbage collection divisor */
35+ private 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+ private const PARAM_SESSION_GC_MAXLIFETIME = 'session/gc_maxlifetime ' ;
42+
3143 /** Configuration path for cookie domain */
3244 const XML_PATH_COOKIE_DOMAIN = 'web/cookie/cookie_domain ' ;
3345
@@ -102,6 +114,7 @@ class Config implements ConfigInterface
102114 * @param string $scopeType
103115 * @param string $lifetimePath
104116 * @SuppressWarnings(PHPMD.NPathComplexity)
117+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
105118 */
106119 public function __construct (
107120 \Magento \Framework \ValidatorFactory $ validatorFactory ,
@@ -149,6 +162,30 @@ public function __construct(
149162 $ this ->setOption ('session.cache_limiter ' , $ cacheLimiter );
150163 }
151164
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+
152189 /**
153190 * Cookie settings: lifetime, path, domain, httpOnly. These govern settings for the session cookie.
154191 */
0 commit comments