summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mirror.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/mirror.php b/mirror.php
index e2f5399..9a6706f 100644
--- a/mirror.php
+++ b/mirror.php
@@ -1,5 +1,5 @@
<?php
-# Copyright © 2016-2017 Luke Shumaker <lukeshu@sbcglobal.net>
+# Copyright © 2016-2018 Luke Shumaker <lukeshu@parabola.nu>
# 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();