diff options
author | Urban Müller | 2021-02-16 15:59:28 +0100 |
---|---|---|
committer | Urban Müller | 2021-02-16 15:59:28 +0100 |
commit | 6f7b883ab4d340610ac3402ea88dc07fa0dc80a7 (patch) | |
tree | d208981e3c8a94c85d8d7781cd51430b362c8c0e | |
parent | d81ae97a311a0e82a5b5f2dea6b75a8e5fdbdd69 (diff) | |
download | itools-6f7b883ab4d340610ac3402ea88dc07fa0dc80a7.tar.gz itools-6f7b883ab4d340610ac3402ea88dc07fa0dc80a7.tar.bz2 itools-6f7b883ab4d340610ac3402ea88dc07fa0dc80a7.zip |
fix errors on get_cache
-rw-r--r-- | it_url.class | 6 |
1 files 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; } |