diff options
Diffstat (limited to 'it_url.class')
-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 e2cd993..7bcf22d 100644 --- a/it_url.class +++ b/it_url.class @@ -601,7 +601,7 @@ static function get_cache($p = array()) if (!is_writable(dirname($path))) it::error("parent dir not writable: " . trim(it::exec('ls -ld {dir} 2>&1', ['dir' => dirname($path)]))); - if (($filemtime = it_url::_expired($path, $p['maxage'], $p['randomexpire'])) || ($p['returnheaders'] && !file_exists(("$path.headers")))) # Outdated(non-zero int) or non-existant(true)? + if (($filemtime = it_url::_expired($path, $p['maxage'], $p['randomexpire'])) || ($p['returnheaders'] && !file_exists(("$path.json")))) # Outdated(non-zero int) or non-existant(true)? { $fileexists = $filemtime !== true; @@ -618,7 +618,7 @@ static function get_cache($p = array()) $success = true; $isnewfile = it_url::_atomicwrite($path, $p['assoc'] ? serialize($data) : $data); if ($p['returnheaders']) - it::file_put_contents("$path.headers", '<?php return ' . var_export($url->headers, true) . ";\n"); + it::file_put("$path.json", it::json_encode($url->headers)); } else if ($p['keepfailed']) $success = $fileexists; @@ -648,7 +648,7 @@ static function get_cache($p = array()) # Read headers before $path is modified for preprocessing if ($p['returnheaders']) - $headers = @include("$path.headers"); + $headers = it::json_decode(it::file_get("$path.json"), 'assoc' => true); if ($success && $p['preprocess']) { |