www - weather - easier debug and maintenance for files

This commit is contained in:
Carsten Haitzler 2021-03-18 12:16:55 +00:00
parent e498262365
commit 27d15794e7
1 changed files with 6 additions and 3 deletions

View File

@ -11,13 +11,16 @@ function response_code($code, $why)
function weather_cache_path($lat, $lon)
{
$t = time();
$d = date('Y-m-d h', $t);
$d = date('Y-m-d_h', $t);
$m = date('i', $t);
// One per coord per 15 mins
$file = md5(sprintf("%s Q%d:%.4f:%.4f", $d, $m/15, $lat, $lon));
$ky = sprintf("%s-Q%d:%.4f:%.4f.json", $d, $m/15, $lat, $lon, $m);
// Use the above filename directly for easier debug.maintenance
//$fl = md5($ky);
$fl = $ky;
$path = $_SERVER["DOCUMENT_ROOT"] .'/'. CACHE_PATH . '/'. $file;
$path = $_SERVER["DOCUMENT_ROOT"] .'/'. CACHE_PATH . '/'. $fl;
return $path;
}