From 6f7b883ab4d340610ac3402ea88dc07fa0dc80a7 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 16 Feb 2021 15:59:28 +0100 Subject: fix errors on get_cache --- it_url.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/it_url.class b/it_url.class index f00f5b6..1c3bfb8 100644 --- a/it_url.class +++ b/it_url.class @@ -525,7 +525,7 @@ static function get_cache_filename($p) /** * Store contents of url in a file and return file name. Threadsafe: Provides locking. Called statically. - * Requires webserver writeable directory in $p['cachdedir']. Params in associative array p: + * Requires webserver writeable directory in $p['cachdedir']. Sends it::error on fails by default. Params: * @param $p['url'] url to get * @param $p['id'] dirname for cached files; same id should have same expire policy * @param $p['headers'] optional array of HTTP headers to send @@ -547,7 +547,7 @@ static function get_cache($p = array()) if (!$p['id'] && $p['maxage']) it::error("calling get_cache with maxage and without id"); - $p += ['timeout' => 10, 'maxage' => 86400, 'cleanbefore' => 7200, 'lock' => true, 'it_error' => $p['safety'] == 0 ? false : ($p['safety'] == 2 ? ['fatal' => true] : [])]; + $p += ['timeout' => 10, 'maxage' => 86400, 'cleanbefore' => 7200, 'lock' => true, 'it_error' => $p['safety'] === 0 ? false : ($p['safety'] == 2 ? ['fatal' => true] : [])]; $p['totaltimeout'] = $p['timeout']; $path = it_url::get_cache_filename($p); # Must be before changing cachedir below $p['cachedir'] = it_url::get_cache_dir($p); @@ -683,7 +683,7 @@ static function get_cache_contents($p) $result = self::_postprocess($result, $p); } else - $result = it::error((array)$p['it_error'] + ['title' => $p['safety'] == 0 ? false : "failed getting " . it_url::absolute($p['url']), 'body' => $p]); + $result = it::error((array)$p['it_error'] + ['title' => $p['safety'] === 0 ? false : "failed getting " . it_url::absolute($p['url']), 'body' => $p]); return $result; } -- cgit v1.2.3