aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2020-07-07 23:29:28 +0200
committerfilip <filip.komar@gmail.com>2020-07-07 23:29:28 +0200
commitbd97ca07e4485aae96db8c4eb819cf2412b5fed8 (patch)
treeea28e31c529b705e21e0985a8116ef0b77d78404
parent01049a4cfb3436b9ec7c7a955617002160483d30 (diff)
lower the priority of other DL protocols from the same domain
-rw-r--r--lib/Downloads.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/Downloads.php b/lib/Downloads.php
index a27757ec6..2a4e1f661 100644
--- a/lib/Downloads.php
+++ b/lib/Downloads.php
@@ -297,6 +297,8 @@ class Downloads
'continent_minus_country' => array(),
'other_continents' => array()
);
+ $hostnames = array();
+ $list_of_mirrs['country_alternate_protocol'] = array();
foreach ($mirs as $curr_continent => $continent_mirrors) {
if ($continent != $curr_continent)
{
@@ -328,13 +330,21 @@ class Downloads
}
if ($mirrorlist)
{
- if ($mirror['country'] == $country)
- {
- $list_of_mirrs['country'][] = $mirror['url'];
+ $pu = parse_url($mirror['url']);
+ if (in_array($pu['host'], $hostnames)) {
+ $list_of_mirrs['country_alternate_protocol'][] = $mirror['url'];
}
else
{
- $list_of_mirrs['continent_minus_country'][] = $mirror['url'];
+ $hostnames[] = $pu['host'];
+ if ($mirror['country'] == $country)
+ {
+ $list_of_mirrs['country'][] = $mirror['url'];
+ }
+ else
+ {
+ $list_of_mirrs['continent_minus_country'][] = $mirror['url'];
+ }
}
}
else
@@ -371,6 +381,7 @@ class Downloads
$resulting_mirrs = array_merge(
$list_of_mirrs['country'],
$list_of_mirrs['continent_minus_country'],
+ $list_of_mirrs['country_alternate_protocol'],
$list_of_mirrs['other_continents']
);
$one_mirror['mirrors_list'] = array_slice($resulting_mirrs, 0, 10);