summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-07-20 21:55:16 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-07-20 21:55:16 -0400
commit20b7523cb72ebcac181284545b4a117a218aa248 (patch)
tree082c9f09c7a9b326923abc1706734b1d14db4724
parent141e9b1c8f9a53b3df94a01a925b88a40d847551 (diff)
mirror: add a minimum ctime
I swear I though I already did this, and that I just needed to bump the value. Huh.
-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();