From 758f97d06eface8069cf6ea7eb068f2d069f608f Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 17 May 2011 22:30:26 +0000 Subject: show iso download popularity; experiment to help guide visitor --- downloads.ini | 10 ++++++++++ downloads.php | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/downloads.ini b/downloads.ini index 809173f90..3d316564f 100644 --- a/downloads.ini +++ b/downloads.ini @@ -8,6 +8,16 @@ errata = "http://www.mageia.org/wiki/doku.php?id=mageia1:errata" notes = "http://www.mageia.org/wiki/doku.php?id=iso1:rc_release_notes" blog = "http://blog.mageia.org/en/2011/05/17/mageia-1-rc/" +[_popularity] +;extracted/normalized from www download logs; need time to make this automatic + post -rda +dvd-i586 = 5 +dvd-x86_64 = 3 +cd-dualarch = 1 +live-kde-europa-cd-i586 = 4 +live-gnome-europa-cd-i586 = 2 +netboot-i586 = 1 +netboot-x86_64 = 1 + [dvd-i586] name = 32bit DVD size = 4GB diff --git a/downloads.php b/downloads.php index bf1e76252..d9f67397e 100644 --- a/downloads.php +++ b/downloads.php @@ -33,17 +33,17 @@ $tmpl = <<%s %s %s +%s %s %s T; -//%s $s = ''; $glob = array_shift($prods); +$popularity = array_shift($prods); $i = 0; foreach ($prods as $k => $p) { - $iso = sprintf('%s-%s', $glob['prefix'], $k); $dl_link = sprintf('/%s/downloads/dl.php?product=%s', $locale, $iso); @@ -51,13 +51,16 @@ foreach ($prods as $k => $p) { sprintf('/%s/downloads/dl.php?product=%s&torrent=1', $locale, $iso) : null; - $pop = rand(0,5); + $pop = array_key_exists($k, $popularity) ? $popularity[$k] : 0; + $s .= sprintf($tmpl, '', //($i == 0) ? ' class="reco"' : '', $p['name'], $_t[$p['lang']], $p['size'], - //$pop, $pop, + $pop, $pop, $dl_link, $_t['download'], - $bt_link, !is_null($bt_link) ? $_t['download'] : ''); + $bt_link, + !is_null($bt_link) ? $_t['download'] : '' + ); $i++; } @@ -69,6 +72,7 @@ $dl_table = <<{$_t['flavour']} {$_t['language']} {$_t['size']} + Popularity {$_t['link']} BitTorrent -- cgit v1.2.1