From adfc2f928918b8556a148a3cd7ac175832628b69 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Sun, 15 May 2011 21:03:41 +0000 Subject: use cached mirrors list instead of static one --- en/downloads/dl.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'en') diff --git a/en/downloads/dl.php b/en/downloads/dl.php index 2584c5026..fbb9d324a 100644 --- a/en/downloads/dl.php +++ b/en/downloads/dl.php @@ -6,7 +6,6 @@ $product = isset($_GET['product']) ? trim(strtolower($_GET['product'])) : null; $torrent = isset($_GET['torrent']) ? true : false; $mirror = isset($_GET['mirror']) ? trim(strtolower($_GET['mirror'])) : null; -include '../../mirrors2.php'; include '../../downloads.php'; include '../../lib/Downloads.php'; @@ -27,6 +26,7 @@ if (!$found) { die; } +$g_mirrors = Downloads::get_all_mirrors(); $product_iso = $product . '.iso'; $wsd = new Downloads('en', null); @@ -54,6 +54,17 @@ else { $title = 'Mageia 1 beta1'; $dl_alt_mirrors_table = ''; + +$g_mirs2 = array(); +foreach ($g_mirrors as $country => $mirs): + foreach ($mirs as $mir): + $g_mirs2[$countries[$country]][$mir['city']][] = $mir['url']; + endforeach; +endforeach; +//print_r($g_mirs2); +$g_mirrors = $g_mirs2; +ksort($g_mirrors); + foreach ($g_mirrors as $country => $cities): foreach ($cities as $city => $mirrors) { $mirs = array(); @@ -63,7 +74,7 @@ foreach ($g_mirrors as $country => $cities): $mirs[] = sprintf('%s://%s', $pm['scheme'], $alt_dl_link, $pm['host']); } - $dl_alt_mirrors_table .= sprintf('%s%s%s', $country, $city, implode(', ', $mirs)); + $dl_alt_mirrors_table .= sprintf('%s%s%s', $country, $city, implode(', ', $mirs)); } endforeach; -- cgit v1.2.1