Skip to content

Commit

Permalink
[core] Added IGNORE_CUSTOM_CACHE_TIMEOUT option
Browse files Browse the repository at this point in the history
  • Loading branch information
em92 committed Oct 29, 2018
1 parent c4896c7 commit 32b9e00
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config.default.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
; false = disabled (default)
custom_timeout = false

; Ignore specified custom timeout for specific requests.
; true = enabled
; false = disabled (default)
ignore_custom_timeout = false

[proxy]

; Sets the proxy url (i.e. "tcp://192.168.0.0:32")
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@

// Cache timeout
$cache_timeout = -1;
if(array_key_exists('_cache_timeout', $params)) {
if(!IGNORE_CUSTOM_CACHE_TIMEOUT && array_key_exists('_cache_timeout', $params)) {

if(!CUSTOM_CACHE_TIMEOUT) {
throw new \HttpException('This server doesn\'t support "_cache_timeout"!');
Expand Down
2 changes: 1 addition & 1 deletion lib/BridgeCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static function displayBridgeCard($bridgeName, $formats, $isActive = true){
);
}

if(CUSTOM_CACHE_TIMEOUT) {
if(CUSTOM_CACHE_TIMEOUT && !IGNORE_CUSTOM_CACHE_TIMEOUT) {
$parameters['global']['_cache_timeout'] = array(
'name' => 'Cache timeout in seconds',
'type' => 'number',
Expand Down
5 changes: 5 additions & 0 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public static function loadConfiguration() {

define('CUSTOM_CACHE_TIMEOUT', self::getConfig('cache', 'custom_timeout'));

if(!is_bool(self::getConfig('cache', 'ignore_custom_timeout')))
die('Parameter [cache] => "ignore_custom_timeout" is not a valid Boolean! Please check "config.ini.php"!');

define('IGNORE_CUSTOM_CACHE_TIMEOUT', self::getConfig('cache', 'ignore_custom_timeout'));

if(!is_bool(self::getConfig('authentication', 'enable')))
die('Parameter [authentication] => "enable" is not a valid Boolean! Please check "config.ini.php"!');

Expand Down

0 comments on commit 32b9e00

Please sign in to comment.