From c3cf4d435f0d7d2a43ee3707addf6e9794df0774 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 29 Apr 2024 12:36:50 +0200 Subject: Also cache 404 in assoc case to keep previous behaviour, server errors >= 500 are not cached --- it_url.class | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'it_url.class') diff --git a/it_url.class b/it_url.class index d9e4869..a94975d 100644 --- a/it_url.class +++ b/it_url.class @@ -616,7 +616,7 @@ static function get_cache($p = array()) EDC('getcache', "new", $filemtime, $p['url'], $path); $url = new it_url; $data = $url->_get($p + ['checkonly' => true, 'filemtime' => EDC('nocache') ? null : $filemtime]); - if ($p['assoc'] ? ($data['status'] == 304 || $data['data']) : $data) + if ($p['assoc'] ? ($data['status'] < 500 || $data['data']) : $data) { $success = true; $isnewfile = it_url::_atomicwrite($path, $p['assoc'] ? ($data['status'] === 304 ? true : it::json_encode($data)) : $data); # $data === true means not modified (no new data fetched) and instructs _atomicwrite to just touch the file -- cgit v1.2.3