From 01506701f9053f9f8971ddda87bdf4a1fb24cdea Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 20 Jul 2018 21:59:23 -0400 Subject: better debugging --- mirror.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mirror.php b/mirror.php index 9a6706f..866d66a 100644 --- a/mirror.php +++ b/mirror.php @@ -40,10 +40,8 @@ if (!file_exists($root.'/'.$filename)) { $mirror = $tier0_url; if (!should_force_tier0($filename)) { $ctime = lstat($root.'/'.$filename)['ctime']; - if ($ctime < $min_ctime) { - $ctime = $min_ctime; - } - header('X-Repomirror-C-Time: '.$ctime); + header('X-Repomirror-File-C-Time: '.$ctime); + header('X-Repomirror-Min-C-Time: '.$min_ctime); // TODO: weight by GeoIP or quality or something? $mirrors = array(); foreach ($mirrors_urls as $mirrors_url) { @@ -59,7 +57,7 @@ if (!file_exists($root.'/'.$filename)) { } foreach ($json['urls'] as $urldata) { if (!in_array($urldata['protocol'], ['http', 'https', 'ftp'])) { continue; } - if (strtotime($urldata['last_sync']) < $ctime) { continue; } + if (strtotime($urldata['last_sync']) < max($ctime, $min_ctime)) { continue; } header('X-Repomirror-Mirror'.count($mirrors).': '.strtotime($urldata['last_sync']).' '.$urldata['url']); $mirrors[] = $urldata['url']; } -- cgit v1.2.2