From 8a8fb6145e6044a1ec630e36f9a9d3c579203a15 Mon Sep 17 00:00:00 2001 From: adixon Date: Thu, 18 Aug 2016 13:13:27 -0400 Subject: [PATCH] convert hard-coded 20 minute secure cache timeout to const with settings override --- CRM/Core/BAO/Cache.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/Cache.php b/CRM/Core/BAO/Cache.php index 41b711e62d..e807d22831 100644 --- a/CRM/Core/BAO/Cache.php +++ b/CRM/Core/BAO/Cache.php @@ -40,6 +40,12 @@ */ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { + /** + * Const the default maximum number of minutes that secure form data should linger + * @var int + */ + const SECURE_TIMEOUT = 20; + /** * @var array ($cacheKey => $cacheValue) */ @@ -306,7 +312,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { */ public static function cleanup($session = FALSE, $table = FALSE, $prevNext = FALSE) { // first delete all sessions more than 20 minutes old which are related to any potential transaction - $timeIntervalMins = 20; + $timeIntervalMins = (int) Civi::settings()->get('secure_cache_timeout_minutes'); + $timeIntervalMins = empty($timeIntervalMins) ? self::SECURE_TIMEOUT : $timeIntervalMins; if (TRUE) { $transactionPages = array( 'CRM_Contribute_Controller_Contribution', -- 2.25.1