downloads.php 4.52 KB
Newer Older
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
<?php
    $title = "VideoLAN - Download Statistics";
    $lang = "en";
    $menu = array( "vlc", "overview" );
    require($_SERVER["DOCUMENT_ROOT"]."/include/header.php");
?>

<div id="fullwidth">
    <h1>VLC download statistics</h1>

    <p>These stats were started at the end of February 2005 and are likely
       to be inaccurate.</p>

    <p>We don't show Linux download statistics as most downloads for this
       OS are made through distributions.</p>

    <h1>Downloads by version and by OS</h1>
    <table border="0">
    <tr>
    <th style="text-align: right;">Version</th>
    <th class="os" style="text-align: right;"><img src="http://images.videolan.org/images/icons/winvista.png" alt="Windows" width="32" height="32" />
    </th>
    <th class="os" style="text-align: right;"><img src="/images/icons/macosx.png" alt="Mac OS X" width="32" height="32" />
    </th>
    <th class="os" style="text-align: right;"><img src="/images/icons/source.gif" alt="Source code" width="32" height="32" />
    </th>
    <th style="text-align: right;">Total</th>
    </tr>

    <?php
    require '/home/videolan/etc/db.php';

    $connect = pg_connect( $connect_string );

    if( !$connect )
    {
        die;
    }

    $requests = array(  "0.7.2" , "0.8.0","0.8.1","0.8.2", "0.8.4", "0.8.5", "0.8.6", "0.9.2", "0.9.3", "0.9.4", "0.9.5", "0.9.6", "0.9.8a", "0.9.9", "0.9.10", "1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.0.6" );
    $wintotal = 0;
    $mactotal = 0;
    $srctotal = 0;

    function f( $n )
    {
        echo "<td style='text-align: right;'>".number_format($n,0,"."," ")."</td>";
    }
    foreach( $requests as $v )
    {
        $versiontotal= 0;
        echo "<tr><td class=\"category\" style=\"text-align: right;\"><strong>$v</strong></td>\n";
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
53
        $winrequest = pg_query( $connect, "select sum(number) from (select * from mirrors where file like '%$v%win32%' union all select * from mirrors_archive where file like '%$v%win32%') as allmirrors;");
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
54
        if( $row  =pg_fetch_array( $winrequest ) )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
55 56 57 58 59 60
        {
            $versiontotal += $row[0];
            $wintotal += $row[0];
            f($row[0]);
        }
        $macrequest = pg_query( $connect, "select sum(number) from (select * from mirrors where file like '%$v%dmg%' union all select * from mirrors_archive where file like '%$v%dmg%') as allmirrors;" );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
61
        if( $row  =pg_fetch_array( $macrequest ) )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
62 63 64 65 66 67
        {
            $versiontotal += $row[0];
            $mactotal += $row[0];
            f($row[0]);
        }
        $srcrequest = pg_query( $connect, "select sum(number) from (select * from mirrors where file like '%$v%tar%' union all select * from mirrors_archive where file like '%$v%tar%') as allmirrors;" );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
68
        if( $row  =pg_fetch_array( $srcrequest ) )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
69 70 71 72 73 74
        {
            $versiontotal += $row[0];
            $srctotal += $row[0];
            f($row[0]);
        }
        f($versiontotal);
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
75 76
        echo "</tr>\n";
    }
77 78 79 80 81

    /* Sourceforge Downloads, from the json auth section
        https://sourceforge.net/projects/vlc/files/1.1.0/win32/stats/json?start_date=2010-06-21&end_date=2012-12-30
        https://sourceforge.net/projects/vlc/files/1.1.0/macosx/stats/json?start_date=2010-06-21&end_date=2012-12-30
        https://sourceforge.net/projects/vlc/files/1.1.0/json?start_date=2010-06-21&end_date=2012-12-30 */
82 83 84
    $table = array( "1.1.0"  => array( "Windows" => 15352734, "Macintosh" => 2538263, "Total" => 17940200 ),
                    "1.1.1"  => array( "Windows" => 5396669 , "Macintosh" => 536578 , "Total" => 5946075 ),
                    "1.1.2"  => array( "Windows" => 11420722, "Macintosh" => 1630259, "Total" => 13089561 ),
85
                    "1.1.3"  => array( "Windows" => 6606436,  "Macintosh" => 5940497, "Total" => 12561243 ),
86
    );
87

88
    foreach( $table as $key => $t )
89
    {
90
        echo "<tr><td class=\"category\" style=\"text-align: right;\"><strong>$key</strong></td>\n";
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
91 92 93 94 95
        $wintotal += $t["Windows"];
        $mactotal += $t["Macintosh"];
        $srctotal += ( $t["Total"] - $t["Windows"] - $t["Macintosh"] );
        f($t["Windows"]);
        f($t["Macintosh"]);
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
96
        f($t["Total"] - $t["Windows"] - $t["Macintosh"]);
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
97 98
        f($t["Total"]);
        echo "</tr>\n";
99
    }
100

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    $maxtotal = $wintotal + $mactotal + $srctotal;
    echo "<tr><td class=\"category\" style=\"text-align: right;\"><strong>Total</strong></td>\n";
    f($wintotal);
    f($mactotal);
    f($srctotal);
    f($maxtotal);
    echo "</tr>\n";

    echo "</table>";

    pg_close($connect);

    echo "<p>Page generated on ".date("r").".</p>";
?>

</div>

<?php footer('$Id$'); ?>