convert hard-coded 20 minute secure cache timeout to const with settings override
authoradixon <alan.g.dixon@gmail.com>
Thu, 18 Aug 2016 17:13:27 +0000 (13:13 -0400)
committerSeamus Lee <seamuslee001@gmail.com>
Tue, 23 Aug 2016 21:18:07 +0000 (07:18 +1000)
CRM/Core/BAO/Cache.php

index 489916d33399656daa5b404e758b968d6357204c..012abb8334533d3b48b0723bd4b4ba009fa91b6c 100644 (file)
  */
 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)
    */
@@ -305,7 +311,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',