diff options
Diffstat (limited to 'it_url.class')
| -rw-r--r-- | it_url.class | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/it_url.class b/it_url.class index dadb1d5..48dbb6f 100644 --- a/it_url.class +++ b/it_url.class @@ -640,14 +640,15 @@ static function get_cache($p = array()) { $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 - if ($p['returnheaders']) - it::file_put("$path.json", it::json_encode($url->headers)); } else if ($p['keepfailed']) - $success = $fileexists; + $success = $kept = $fileexists; else @unlink($path); # Expired and failed to get + if ($p['returnheaders'] && !$kept) + it::file_put("$path.json", it::json_encode($url->headers)); + it_url::_unlock($path, $lock); } else |