From e31ec4507c495254239f11841d81c865e80e41a9 Mon Sep 17 00:00:00 2001 From: filip Date: Sat, 2 May 2015 16:13:53 +0200 Subject: adding download of pdf and epub file infrastructure --- en/doc/doc.php | 8 +- en/doc/index.php | 12 +- en/downloads/get/definitions_doc.ini | 29 + en/downloads/get/index.php | 22 +- en/downloads/get/lib.php | 5 +- lib/Downloads.php | 47 +- lib/cached.list_doc.php | 1077 ++++++++++++++++++++++++++++++++++ tools/update-mirrors-list.php | 15 +- 8 files changed, 1180 insertions(+), 35 deletions(-) create mode 100644 en/downloads/get/definitions_doc.ini create mode 100644 lib/cached.list_doc.php diff --git a/en/doc/doc.php b/en/doc/doc.php index 0be4aa318..9015b3626 100644 --- a/en/doc/doc.php +++ b/en/doc/doc.php @@ -33,7 +33,7 @@ function doc_list($documentation_name, $type, $version, $link, $epub_link = null $other_languages_present = FALSE; $note_printed = FALSE; // temporary hidding of the EPUB and PDF links - $hide_epub_pdf = TRUE; + $hide_epub_pdf = FALSE; $table = PHP_EOL . '' . PHP_EOL; // $table .= ''; $table .= "\t" . PHP_EOL; @@ -52,7 +52,7 @@ function doc_list($documentation_name, $type, $version, $link, $epub_link = null '' . $documentation_name . '', $lng_name, sprintf($link, $lng)); } else { $your_language = sprintf(_r('%s available in %s') . '
%s ('. - _r('also as') . '%s , %s)', + _r('also as') . ' %s, %s)', '' . $documentation_name . '', $lng_name, sprintf($link, $lng), sprintf($epub_link, $lng), sprintf($pdf_link, $lng)); } @@ -62,12 +62,12 @@ function doc_list($documentation_name, $type, $version, $link, $epub_link = null $others[] = sprintf('%s
%s', $lng_name, sprintf($link, $lng)); } else { if(!$note_printed) { - $note = _r('also as'); + $note = _r('also as') . ' '; $note_printed = TRUE; } else { $note = ''; } - $others[] = sprintf('%s
%s (%s%s , %s)', + $others[] = sprintf('%s
%s (%s%s, %s)', $lng_name, sprintf($link, $lng), $note, sprintf($epub_link, $lng), sprintf($pdf_link, $lng), sprintf($link, $lng)); } } diff --git a/en/doc/index.php b/en/doc/index.php index 54ff6d964..157f834c1 100644 --- a/en/doc/index.php +++ b/en/doc/index.php @@ -34,16 +34,16 @@ require 'doc.php';

HTML', - 'EPUB', - 'PDF'); - ?>

+ 'EPUB', + 'PDF'); + ?>

HTML', - 'EPUB', - 'PDF'); - ?>

+ 'EPUB', + 'PDF'); + ?>

diff --git a/en/downloads/get/definitions_doc.ini b/en/downloads/get/definitions_doc.ini new file mode 100644 index 000000000..4acfa8b17 --- /dev/null +++ b/en/downloads/get/definitions_doc.ini @@ -0,0 +1,29 @@ +; Downloads definitions file. +; This is a whitelist for what can be downloaded from mageia.org +; through the download redirector (to official Mageia mirrors). +; + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; Mageia documentation +;;;;;;;;;;;;;;;;;;;;; + +[Mageia4_DrakX_en_epub] +size = around 2 MB +path = people/marcom/doc/mga4/epub/installer +langs = "ca|cs|de|el|en|eo|es|et|eu|fr|id|nl|pl|pt_br|ro|ru|sq|sv|tr|uk" ; it epub is currently missing + +[Mageia4_DrakX_en_pdf] +size = around 2 MB +path = people/marcom/doc/mga4/pdf/installer +langs = "ca|cs|de|el|en|eo|es|et|eu|fr|id|it|nl|pl|pt_br|ro|ru|sq|sv|tr|uk" + +[Mageia4_MCC_en_epub] +size = around 10 MB +path = people/marcom/doc/mga4/epub/mcc +langs = "de|en|et|fr|ro|ru|tr|uk" + +[Mageia4_MCC_en_pdf] +size = around 10 MB +path = people/marcom/doc/mga4/pdf/mcc +langs = "de|en|et|fr|ro|ru|tr|uk" diff --git a/en/downloads/get/index.php b/en/downloads/get/index.php index 0678b9f0a..fc4497f98 100644 --- a/en/downloads/get/index.php +++ b/en/downloads/get/index.php @@ -37,6 +37,7 @@ require 'lib.php'; // request $product = get('q'); +$doc = get('doc'); $debug = get('d'); if (isset($_GET['torrent'])) { $torrent = strip_tags(trim($_GET['torrent'])); @@ -58,14 +59,31 @@ session_start(); $download = null; $js_redirect = null; $reason = null; +if ($doc == 'yes') { + $def_file = 'definitions_doc.ini'; + list($release, $type, $lang, $extension) = explode('_', $product); // 'Mageia4_DrakX_en_epub' + $product = implode('_', array($release, $type, 'en', $extension)); + $documentation = true; +} else { + $def_file = 'definitions.ini'; + $documentation = false; +} try { // TODO simplify and wrap all this in a single interface: // list(dl_template, mirrors) = get_download_options_for(product) // Step 1. include '../../../lib/Downloads.php'; - $product = get_info_for_product($product); - $all_mirrors = get_mirrors_for($product['file'], 'en', get('country')); + $product = get_info_for_product($product, $def_file); + if ($doc == 'yes') { + $langs = explode('|', $product['langs']); + if (!in_array($lang, $langs)) { + $lang = 'en'; // fallback language + } + $product['file'] = $release . '-' . $type . '-' . $lang . '.' . $extension; + $product['name'] = $product['file']; + } + $all_mirrors = get_mirrors_for($product['file'], 'en', get('country'), true, $documentation); $one_mirror = $all_mirrors[0]; $alt_mirrors = $all_mirrors[1]; $download_tmpl = get_download_link($product, $torrent); diff --git a/en/downloads/get/lib.php b/en/downloads/get/lib.php index 35bbe985c..b730b767d 100644 --- a/en/downloads/get/lib.php +++ b/en/downloads/get/lib.php @@ -22,6 +22,7 @@ $countries = array( 'CN' => '中国', // China 'CZ' => 'Česko', // Czechia 'DE' => 'Deutschland', + 'EC' => 'Ecuador', 'ES' => 'España', 'FR' => 'France', 'GB' => 'Great Britain', @@ -125,11 +126,11 @@ function get_info_for_product($product, $def_file = null) * speed * link */ -function get_mirrors_for($file, $locale = null, $country = null) +function get_mirrors_for($file, $locale = null, $country = null, $prod = true, $documentation = false) { //include '../../../lib/Downloads.php'; - $mirrors = Downloads::get_all_mirrors(); + $mirrors = Downloads::get_all_mirrors($prod, $documentation); $wsd = new Downloads(); $one = $wsd->prepare_download(true, $country); diff --git a/lib/Downloads.php b/lib/Downloads.php index a44404ea0..247cb5f50 100644 --- a/lib/Downloads.php +++ b/lib/Downloads.php @@ -96,56 +96,63 @@ class Downloads * * @return array */ - public static function get_all_mirrors($prod = true) + public static function get_all_mirrors($prod = true, $documentation = false) { - $cache_file = realpath(__DIR__ . '/cached.list.php'); + if ($documentation) { + $cache_file = realpath(__DIR__ . '/cached.list_doc.php'); + } else { + $cache_file = realpath(__DIR__ . '/cached.list.php'); + } if ($prod) { require $cache_file; } else { - $data = file('http://mirrors.mageia.org/api/mageia.1.i586.list'); + $data = file('http://mirrors.mageia.org/api/mageia.4.i586.list'); $mirrors = array(); foreach ($data as $line) { $line = explode(',', trim($line)); $m = array(); foreach ($line as $val) { $val = explode('=', trim($val)); - $m[$val[0]] = $val[1]; + if (!empty($val[1])) { + $m[$val[0]] = $val[1]; + } } - $pu = parse_url($m['url']); - if (in_array($pu['scheme'], array('http', 'ftp'))) { - + $pu = parse_url($m['url']); + if (in_array($pu['scheme'], array('http', 'https', 'ftp'))) { $item = array( 'city' => isset($m['city']) ? $m['city'] : '?', 'continent' => isset($m['continent']) ? $m['continent'] : '?', 'zone' => $m['zone'], // BEWARE of the path substitution here. Must match. - 'url' => str_replace('/distrib/1/i586', '', $m['url']) + 'url' => str_replace('/distrib/4/i586', '', $m['url']) ); - - $torrent =$item['url'].'/iso/3/torrents/Mageia-3-LiveDVD-KDE4-x86_64-DVD.torrent' ; - if (false === file_get_contents($torrent)){ - echo "down $torrent \n"; - } else { - echo "Up $torrent \n"; - $mirrors[$m['country']][] = $item; - $mirrors['_C:' . $m['continent']][] = $item; - } + if ($documentation) { + $test_file = $item['url'].'/people/marcom/doc/mga4/date.txt'; + } else { + $test_file = $item['url'].'/iso/4.1/torrents/Mageia-4.1-LiveDVD-KDE4-x86_64-DVD.torrent'; + } + if (false === file_get_contents($test_file)) { + echo "down $test_file \n"; + } else { + echo "Up $test_file \n"; + $mirrors[$m['country']][] = $item; + $mirrors['_C:' . $m['continent']][] = $item; + } } } file_put_contents($cache_file, - sprintf('', - var_export($mirrors, true))); + sprintf('' . PHP_EOL, var_export($mirrors, true))); } return $mirrors; } /** - * Get mirrors from stored dictionnary and find: + * Get mirrors from stored dictionary and find: * - best matching country * - or best matching continent * - or random diff --git a/lib/cached.list_doc.php b/lib/cached.list_doc.php new file mode 100644 index 000000000..96b88b902 --- /dev/null +++ b/lib/cached.list_doc.php @@ -0,0 +1,1077 @@ + + array ( + 0 => + array ( + 'city' => 'Hefei', + 'continent' => 'AS', + 'zone' => 'CN', + 'url' => 'http://mirrors.ustc.edu.cn/mageia', + ), + 1 => + array ( + 'city' => 'Hefei', + 'continent' => 'AS', + 'zone' => 'CN', + 'url' => 'ftp://mirrors.ustc.edu.cn/mageia', + ), + 2 => + array ( + 'city' => 'Hefei', + 'continent' => 'AS', + 'zone' => 'CN', + 'url' => 'https://mirrors.ustc.edu.cn/mageia', + ), + ), + '_C:AS' => + array ( + 0 => + array ( + 'city' => 'Hefei', + 'continent' => 'AS', + 'zone' => 'CN', + 'url' => 'http://mirrors.ustc.edu.cn/mageia', + ), + 1 => + array ( + 'city' => 'Tsukuba', + 'continent' => 'AS', + 'zone' => 'JP', + 'url' => 'http://ftp.tsukuba.wide.ad.jp/Linux/mageia', + ), + 2 => + array ( + 'city' => 'HsinChu', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'ftp://ftp.twaren.net/Linux/Mageia', + ), + 3 => + array ( + 'city' => 'Hefei', + 'continent' => 'AS', + 'zone' => 'CN', + 'url' => 'ftp://mirrors.ustc.edu.cn/mageia', + ), + 4 => + array ( + 'city' => 'Taipei', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'ftp://ftp.tku.edu.tw/Linux/Mageia', + ), + 5 => + array ( + 'city' => 'Ankara', + 'continent' => 'AS', + 'zone' => 'TR', + 'url' => 'http://ftp.linux.org.tr/mageia', + ), + 6 => + array ( + 'city' => 'Ankara', + 'continent' => 'AS', + 'zone' => 'TR', + 'url' => 'ftp://ftp.linux.org.tr/mageia', + ), + 7 => + array ( + 'city' => 'Chungli', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'http://ftp.yzu.edu.tw/Linux/Mageia', + ), + 8 => + array ( + 'city' => 'Taipei', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'http://ftp.tku.edu.tw/Linux/Mageia', + ), + 9 => + array ( + 'city' => 'Chungli', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'ftp://ftp.yzu.edu.tw/Linux/Mageia', + ), + 10 => + array ( + 'city' => 'Hefei', + 'continent' => 'AS', + 'zone' => 'CN', + 'url' => 'https://mirrors.ustc.edu.cn/mageia', + ), + ), + 'CZ' => + array ( + 0 => + array ( + 'city' => 'Brno', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'http://ftp.fi.muni.cz/pub/linux/mageia', + ), + 1 => + array ( + 'city' => 'Brno', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'ftp://ftp.fi.muni.cz/pub/linux/mageia', + ), + 2 => + array ( + 'city' => 'Zlin', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'ftp://mirror.oss.maxcdn.com/mageia', + ), + 3 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'http://mageia.supp.name', + ), + 4 => + array ( + 'city' => 'Zlin', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'http://mirror.oss.maxcdn.com/mageia', + ), + ), + '_C:EU' => + array ( + 0 => + array ( + 'city' => 'Brno', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'http://ftp.fi.muni.cz/pub/linux/mageia', + ), + 1 => + array ( + 'city' => 'Erlangen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://ftp.uni-erlangen.de/mirrors/Mageia', + ), + 2 => + array ( + 'city' => 'Erlangen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://ftp.uni-erlangen.de/mirrors/Mageia', + ), + 3 => + array ( + 'city' => 'Roma', + 'continent' => 'EU', + 'zone' => 'IT', + 'url' => 'http://mageia.mirror.garr.it/mirrors/mageia', + ), + 4 => + array ( + 'city' => 'Uppsala', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'http://ftp.sunet.se/pub/Linux/distributions/mageia', + ), + 5 => + array ( + 'city' => 'Minsk', + 'continent' => 'EU', + 'zone' => 'BY', + 'url' => 'ftp://mirror.datacenter.by/pub/mirrors/mageia.org', + ), + 6 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://srv3.tuxinator.org/mageia', + ), + 7 => + array ( + 'city' => 'Hermsdorf', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://mirror.tuxinator.org/mageia', + ), + 8 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://mirror2.tuxinator.org/mageia', + ), + 9 => + array ( + 'city' => 'Brno', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'ftp://ftp.fi.muni.cz/pub/linux/mageia', + ), + 10 => + array ( + 'city' => 'Zlin', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'ftp://mirror.oss.maxcdn.com/mageia', + ), + 11 => + array ( + 'city' => 'Heraklion', + 'continent' => 'EU', + 'zone' => 'GR', + 'url' => 'ftp://ftp.cc.uoc.gr/mirrors/linux/mageia', + ), + 12 => + array ( + 'city' => 'Uppsala', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'ftp://ftp.sunet.se/pub/Linux/distributions/mageia', + ), + 13 => + array ( + 'city' => 'Umeå', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'http://ftp.acc.umu.se/mirror/mageia', + ), + 14 => + array ( + 'city' => 'Milan', + 'continent' => 'EU', + 'zone' => 'IT', + 'url' => 'http://vodka.sublink.org/mageia', + ), + 15 => + array ( + 'city' => 'Esslingen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia', + ), + 16 => + array ( + 'city' => 'Canterbury', + 'continent' => 'EU', + 'zone' => 'GB', + 'url' => 'http://www.mirrorservice.org/sites/mageia.org/pub/mageia', + ), + 17 => + array ( + 'city' => 'Enschede', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'http://ftp.snt.utwente.nl/pub/os/linux/mageia', + ), + 18 => + array ( + 'city' => 'Göttingen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://ftp5.gwdg.de/pub/linux/mageia', + ), + 19 => + array ( + 'city' => 'Esslingen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia', + ), + 20 => + array ( + 'city' => 'Heraklion', + 'continent' => 'EU', + 'zone' => 'GR', + 'url' => 'http://ftp.cc.uoc.gr/mirrors/linux/mageia', + ), + 21 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'http://mageia.supp.name', + ), + 22 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://mirror2.tuxinator.org/mageia', + ), + 23 => + array ( + 'city' => 'Zlin', + 'continent' => 'EU', + 'zone' => 'CZ', + 'url' => 'http://mirror.oss.maxcdn.com/mageia', + ), + 24 => + array ( + 'city' => 'Erlangen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'https://ftp.uni-erlangen.de/mageia', + ), + 25 => + array ( + 'city' => 'Amsterdam', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'http://ftp.nluug.nl/pub/os/Linux/distr/mageia', + ), + 26 => + array ( + 'city' => 'Moscow', + 'continent' => 'EU', + 'zone' => 'RU', + 'url' => 'http://mirror.yandex.ru/mageia', + ), + 27 => + array ( + 'city' => 'Roma', + 'continent' => 'EU', + 'zone' => 'IT', + 'url' => 'ftp://mageia.mirror.garr.it/mirrors/mageia', + ), + 28 => + array ( + 'city' => 'Enschede', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'ftp://ftp.snt.utwente.nl/pub/os/linux/mageia', + ), + 29 => + array ( + 'city' => 'Paris', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia', + ), + 30 => + array ( + 'city' => 'Cologne', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://mirror.netcologne.de/mageia', + ), + 31 => + array ( + 'city' => 'Minsk', + 'continent' => 'EU', + 'zone' => 'BY', + 'url' => 'http://mirror.datacenter.by/pub/mirrors/mageia.org', + ), + 32 => + array ( + 'city' => 'Paris', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'http://aglae.biomedicale.univ-paris5.fr', + ), + 33 => + array ( + 'city' => 'Hermsdorf', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://mirror.tuxinator.org/mageia', + ), + 34 => + array ( + 'city' => 'Umeå', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'ftp://ftp.acc.umu.se/mirror/mageia', + ), + 35 => + array ( + 'city' => 'Amsterdam', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'ftp://ftp.nluug.nl/pub/os/Linux/distr/mageia', + ), + 36 => + array ( + 'city' => 'geneva', + 'continent' => 'EU', + 'zone' => 'CH', + 'url' => 'http://mageia.unige.ch/mirror', + ), + 37 => + array ( + 'city' => 'Lyon', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'ftp://fr2.rpmfind.net/linux/mageia', + ), + 38 => + array ( + 'city' => 'Cologne', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://mirror.netcologne.de/mageia', + ), + 39 => + array ( + 'city' => 'Lyon', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'http://fr2.rpmfind.net/linux/mageia', + ), + 40 => + array ( + 'city' => 'Paris', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia', + ), + 41 => + array ( + 'city' => 'Moscow', + 'continent' => 'EU', + 'zone' => 'RU', + 'url' => 'http://mirrors-ru.go-parts.com/mageia', + ), + 42 => + array ( + 'city' => 'Canterbury', + 'continent' => 'EU', + 'zone' => 'GB', + 'url' => 'ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia', + ), + ), + 'DE' => + array ( + 0 => + array ( + 'city' => 'Erlangen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://ftp.uni-erlangen.de/mirrors/Mageia', + ), + 1 => + array ( + 'city' => 'Erlangen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://ftp.uni-erlangen.de/mirrors/Mageia', + ), + 2 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://srv3.tuxinator.org/mageia', + ), + 3 => + array ( + 'city' => 'Hermsdorf', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://mirror.tuxinator.org/mageia', + ), + 4 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://mirror2.tuxinator.org/mageia', + ), + 5 => + array ( + 'city' => 'Esslingen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia', + ), + 6 => + array ( + 'city' => 'Göttingen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://ftp5.gwdg.de/pub/linux/mageia', + ), + 7 => + array ( + 'city' => 'Esslingen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia', + ), + 8 => + array ( + 'city' => '?', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://mirror2.tuxinator.org/mageia', + ), + 9 => + array ( + 'city' => 'Erlangen', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'https://ftp.uni-erlangen.de/mageia', + ), + 10 => + array ( + 'city' => 'Cologne', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://mirror.netcologne.de/mageia', + ), + 11 => + array ( + 'city' => 'Hermsdorf', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'http://mirror.tuxinator.org/mageia', + ), + 12 => + array ( + 'city' => 'Cologne', + 'continent' => 'EU', + 'zone' => 'DE', + 'url' => 'ftp://mirror.netcologne.de/mageia', + ), + ), + 'IT' => + array ( + 0 => + array ( + 'city' => 'Roma', + 'continent' => 'EU', + 'zone' => 'IT', + 'url' => 'http://mageia.mirror.garr.it/mirrors/mageia', + ), + 1 => + array ( + 'city' => 'Milan', + 'continent' => 'EU', + 'zone' => 'IT', + 'url' => 'http://vodka.sublink.org/mageia', + ), + 2 => + array ( + 'city' => 'Roma', + 'continent' => 'EU', + 'zone' => 'IT', + 'url' => 'ftp://mageia.mirror.garr.it/mirrors/mageia', + ), + ), + 'US' => + array ( + 0 => + array ( + 'city' => 'Southfeild', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'http://mirror.nexcess.net/mageia', + ), + 1 => + array ( + 'city' => '?', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'http://mirrors.kernel.org/mageia', + ), + 2 => + array ( + 'city' => 'Southfeild', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'ftp://mirror.nexcess.net/mageia', + ), + 3 => + array ( + 'city' => 'glen allen', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'http://mageia.jameswhitby.net/mageia', + ), + 4 => + array ( + 'city' => 'glen allen', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'ftp://mageia.jameswhitby.net/mageia', + ), + ), + '_C:NA' => + array ( + 0 => + array ( + 'city' => 'Southfeild', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'http://mirror.nexcess.net/mageia', + ), + 1 => + array ( + 'city' => '?', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'http://mirrors.kernel.org/mageia', + ), + 2 => + array ( + 'city' => 'Toronto', + 'continent' => 'NA', + 'zone' => 'CA', + 'url' => 'ftp://mageia.webconquest.com', + ), + 3 => + array ( + 'city' => 'Toronto', + 'continent' => 'NA', + 'zone' => 'CA', + 'url' => 'http://mageia.webconquest.com', + ), + 4 => + array ( + 'city' => 'Southfeild', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'ftp://mirror.nexcess.net/mageia', + ), + 5 => + array ( + 'city' => 'glen allen', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'http://mageia.jameswhitby.net/mageia', + ), + 6 => + array ( + 'city' => 'glen allen', + 'continent' => 'NA', + 'zone' => 'US', + 'url' => 'ftp://mageia.jameswhitby.net/mageia', + ), + ), + 'SE' => + array ( + 0 => + array ( + 'city' => 'Uppsala', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'http://ftp.sunet.se/pub/Linux/distributions/mageia', + ), + 1 => + array ( + 'city' => 'Uppsala', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'ftp://ftp.sunet.se/pub/Linux/distributions/mageia', + ), + 2 => + array ( + 'city' => 'Umeå', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'http://ftp.acc.umu.se/mirror/mageia', + ), + 3 => + array ( + 'city' => 'Umeå', + 'continent' => 'EU', + 'zone' => 'SE', + 'url' => 'ftp://ftp.acc.umu.se/mirror/mageia', + ), + ), + 'BY' => + array ( + 0 => + array ( + 'city' => 'Minsk', + 'continent' => 'EU', + 'zone' => 'BY', + 'url' => 'ftp://mirror.datacenter.by/pub/mirrors/mageia.org', + ), + 1 => + array ( + 'city' => 'Minsk', + 'continent' => 'EU', + 'zone' => 'BY', + 'url' => 'http://mirror.datacenter.by/pub/mirrors/mageia.org', + ), + ), + 'GR' => + array ( + 0 => + array ( + 'city' => 'Heraklion', + 'continent' => 'EU', + 'zone' => 'GR', + 'url' => 'ftp://ftp.cc.uoc.gr/mirrors/linux/mageia', + ), + 1 => + array ( + 'city' => 'Heraklion', + 'continent' => 'EU', + 'zone' => 'GR', + 'url' => 'http://ftp.cc.uoc.gr/mirrors/linux/mageia', + ), + ), + 'CA' => + array ( + 0 => + array ( + 'city' => 'Toronto', + 'continent' => 'NA', + 'zone' => 'CA', + 'url' => 'ftp://mageia.webconquest.com', + ), + 1 => + array ( + 'city' => 'Toronto', + 'continent' => 'NA', + 'zone' => 'CA', + 'url' => 'http://mageia.webconquest.com', + ), + ), + 'BR' => + array ( + 0 => + array ( + 'city' => 'Campinas', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'ftp://ftp.las.ic.unicamp.br/pub/mageia', + ), + 1 => + array ( + 'city' => 'Brasilia', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'http://mageia.fis.unb.br', + ), + 2 => + array ( + 'city' => 'Campinas', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'http://ftp.las.ic.unicamp.br/pub/mageia', + ), + 3 => + array ( + 'city' => '?', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'ftp://mageia.c3sl.ufpr.br/mageia', + ), + 4 => + array ( + 'city' => '?', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'http://mageia.c3sl.ufpr.br', + ), + ), + '_C:SA' => + array ( + 0 => + array ( + 'city' => 'Campinas', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'ftp://ftp.las.ic.unicamp.br/pub/mageia', + ), + 1 => + array ( + 'city' => 'Cuenca', + 'continent' => 'SA', + 'zone' => 'EC', + 'url' => 'ftp://mirror.cedia.org.ec/mageia', + ), + 2 => + array ( + 'city' => 'Brasilia', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'http://mageia.fis.unb.br', + ), + 3 => + array ( + 'city' => 'Campinas', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'http://ftp.las.ic.unicamp.br/pub/mageia', + ), + 4 => + array ( + 'city' => '?', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'ftp://mageia.c3sl.ufpr.br/mageia', + ), + 5 => + array ( + 'city' => 'Cuenca', + 'continent' => 'SA', + 'zone' => 'EC', + 'url' => 'http://mirror.cedia.org.ec/mageia', + ), + 6 => + array ( + 'city' => '?', + 'continent' => 'SA', + 'zone' => 'BR', + 'url' => 'http://mageia.c3sl.ufpr.br', + ), + ), + 'JP' => + array ( + 0 => + array ( + 'city' => 'Tsukuba', + 'continent' => 'AS', + 'zone' => 'JP', + 'url' => 'http://ftp.tsukuba.wide.ad.jp/Linux/mageia', + ), + ), + 'GB' => + array ( + 0 => + array ( + 'city' => 'Canterbury', + 'continent' => 'EU', + 'zone' => 'GB', + 'url' => 'http://www.mirrorservice.org/sites/mageia.org/pub/mageia', + ), + 1 => + array ( + 'city' => 'Canterbury', + 'continent' => 'EU', + 'zone' => 'GB', + 'url' => 'ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia', + ), + ), + 'NL' => + array ( + 0 => + array ( + 'city' => 'Enschede', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'http://ftp.snt.utwente.nl/pub/os/linux/mageia', + ), + 1 => + array ( + 'city' => 'Amsterdam', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'http://ftp.nluug.nl/pub/os/Linux/distr/mageia', + ), + 2 => + array ( + 'city' => 'Enschede', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'ftp://ftp.snt.utwente.nl/pub/os/linux/mageia', + ), + 3 => + array ( + 'city' => 'Amsterdam', + 'continent' => 'EU', + 'zone' => 'NL', + 'url' => 'ftp://ftp.nluug.nl/pub/os/Linux/distr/mageia', + ), + ), + 'ZA' => + array ( + 0 => + array ( + 'city' => 'Stellenbosch', + 'continent' => 'AF', + 'zone' => 'ZA', + 'url' => 'ftp://ftp.sun.ac.za/pub/mirrors/mageia', + ), + 1 => + array ( + 'city' => 'Stellenbosch', + 'continent' => 'AF', + 'zone' => 'ZA', + 'url' => 'http://ftp.sun.ac.za/ftp/pub/mirrors/mageia', + ), + ), + '_C:AF' => + array ( + 0 => + array ( + 'city' => 'Stellenbosch', + 'continent' => 'AF', + 'zone' => 'ZA', + 'url' => 'ftp://ftp.sun.ac.za/pub/mirrors/mageia', + ), + 1 => + array ( + 'city' => 'Stellenbosch', + 'continent' => 'AF', + 'zone' => 'ZA', + 'url' => 'http://ftp.sun.ac.za/ftp/pub/mirrors/mageia', + ), + ), + 'TW' => + array ( + 0 => + array ( + 'city' => 'HsinChu', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'ftp://ftp.twaren.net/Linux/Mageia', + ), + 1 => + array ( + 'city' => 'Taipei', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'ftp://ftp.tku.edu.tw/Linux/Mageia', + ), + 2 => + array ( + 'city' => 'Chungli', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'http://ftp.yzu.edu.tw/Linux/Mageia', + ), + 3 => + array ( + 'city' => 'Taipei', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'http://ftp.tku.edu.tw/Linux/Mageia', + ), + 4 => + array ( + 'city' => 'Chungli', + 'continent' => 'AS', + 'zone' => 'TW', + 'url' => 'ftp://ftp.yzu.edu.tw/Linux/Mageia', + ), + ), + 'AU' => + array ( + 0 => + array ( + 'city' => 'Adelaide', + 'continent' => 'OC', + 'zone' => 'AU', + 'url' => 'http://mirror.internode.on.net/pub/mageia', + ), + ), + '_C:OC' => + array ( + 0 => + array ( + 'city' => 'Adelaide', + 'continent' => 'OC', + 'zone' => 'AU', + 'url' => 'http://mirror.internode.on.net/pub/mageia', + ), + ), + 'RU' => + array ( + 0 => + array ( + 'city' => 'Moscow', + 'continent' => 'EU', + 'zone' => 'RU', + 'url' => 'http://mirror.yandex.ru/mageia', + ), + 1 => + array ( + 'city' => 'Moscow', + 'continent' => 'EU', + 'zone' => 'RU', + 'url' => 'http://mirrors-ru.go-parts.com/mageia', + ), + ), + 'FR' => + array ( + 0 => + array ( + 'city' => 'Paris', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia', + ), + 1 => + array ( + 'city' => 'Paris', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'http://aglae.biomedicale.univ-paris5.fr', + ), + 2 => + array ( + 'city' => 'Lyon', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'ftp://fr2.rpmfind.net/linux/mageia', + ), + 3 => + array ( + 'city' => 'Lyon', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'http://fr2.rpmfind.net/linux/mageia', + ), + 4 => + array ( + 'city' => 'Paris', + 'continent' => 'EU', + 'zone' => 'FR', + 'url' => 'ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia', + ), + ), + 'TR' => + array ( + 0 => + array ( + 'city' => 'Ankara', + 'continent' => 'AS', + 'zone' => 'TR', + 'url' => 'http://ftp.linux.org.tr/mageia', + ), + 1 => + array ( + 'city' => 'Ankara', + 'continent' => 'AS', + 'zone' => 'TR', + 'url' => 'ftp://ftp.linux.org.tr/mageia', + ), + ), + 'EC' => + array ( + 0 => + array ( + 'city' => 'Cuenca', + 'continent' => 'SA', + 'zone' => 'EC', + 'url' => 'ftp://mirror.cedia.org.ec/mageia', + ), + 1 => + array ( + 'city' => 'Cuenca', + 'continent' => 'SA', + 'zone' => 'EC', + 'url' => 'http://mirror.cedia.org.ec/mageia', + ), + ), + 'CH' => + array ( + 0 => + array ( + 'city' => 'geneva', + 'continent' => 'EU', + 'zone' => 'CH', + 'url' => 'http://mageia.unige.ch/mirror', + ), + ), +); ?> diff --git a/tools/update-mirrors-list.php b/tools/update-mirrors-list.php index d9be85226..ee17f9b2c 100644 --- a/tools/update-mirrors-list.php +++ b/tools/update-mirrors-list.php @@ -2,7 +2,20 @@ /** * Run this to update lib/cached.list.php mirrors list from mirrors.mageia.org/api * + * Usage for regeneration of cached.list.php for ISO and torrent files: + * php ./tools/update-mirrors-list.php + * + * Usage for regeneration of cached.list_doc.php for documentation files: + * php ./tools/update-mirrors-list.php true + * */ require __DIR__ . '/../lib/Downloads.php'; -Downloads::get_all_mirrors(false); \ No newline at end of file +$documentation = isset($argv[1]) ? $argv[1] : false; + +if($documentation) { + echo 'Rebuilding' . __DIR__ . '/cached.list_doc.php with date.txt as a test file.' . PHP_EOL; +} else { + echo 'Rebuilding' . __DIR__ . '/cached.list.php with one torrent as a test file.' . PHP_EOL; +} +Downloads::get_all_mirrors(false, $documentation); -- cgit v1.2.1