From 20b7523cb72ebcac181284545b4a117a218aa248 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 20 Jul 2018 21:55:16 -0400 Subject: mirror: add a minimum ctime I swear I though I already did this, and that I just needed to bump the value. Huh. --- mirror.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mirror.php b/mirror.php index e2f5399..9a6706f 100644 --- a/mirror.php +++ b/mirror.php @@ -1,5 +1,5 @@ +# Copyright © 2016-2018 Luke Shumaker # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See the ./COPYING file for more details. @@ -16,6 +16,9 @@ $mirrors_urls = [ 'https://www.parabola.nu/mirrors/status/tier/1/json' function should_force_tier0($filename) { return file_exists('/srv/repo/http/'.$filename) || (preg_match("/\.(db|files)(\.tar(\..z)?)?$/" , $filename) == 1); } +// 2018-06-22 20:28, when the dbscripts 20180611-1 -> 20180612-1 +// upgrade happened. ctimes before that are not to be trusted. +$min_ctime = 1529699280; // Automatic configuration $assetdir = dirname($_SERVER["SCRIPT_FILENAME"]); @@ -37,6 +40,9 @@ 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); // TODO: weight by GeoIP or quality or something? $mirrors = array(); -- cgit v1.2.2