aboutsummaryrefslogtreecommitdiffstats
path: root/Report/Box/02_SourcePackage.php
blob: 9ba0039d87c60ab3fd185657772b8370fb1cf79d (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
 * Source packages reporting box.
 *
 * PHP version 5
 *
 * @category Dashboard
 * @package  Buildsystem
 * @author   Romain d'Alverny <rda@mageia.org>
 * @license  MIT License, see LICENSE.txt
 * @link     http://svnweb.mageia.org/svn/soft/dashboard/
*/

/**
*/
class Report_Box_SourcePackage extends Report_Box
{
    /**
    */
    var $title = "Source packages";
    
    /**
    */
    function _get_var_definitions() {
        return array(
            'size'     => '%5.1fGB',
            'count-srpms' => '%d packages',
            'upstream-updates' => array('l' => '%d have an update', 't' => '==0'),
            'orphans'  => array('l' => '%d orphans', 't' => '>0'),
            'patches'  => '%d patches',
            'bugs'     => array('l' => '%d open bugs', 't' => '>0'),
            'rpmlint'  => array('l' => '%d rpmlint errors', 't' => '>0'),
        );
    }

    /**
    */
    function _get_links()
    {
        return 'View <a href="http://svn.mageia.org/">svn</a>, <a href="http://check.mageia.org/updates.html">youri-check report</a>';
    }

    /**
     * Uses youri-check updates report (check.mageia.org)
    */
    function _fetch_upstream_updates()
    {
        $txt = file('http://check.mageia.org/updates.txt');
        return array(
            'upstream-updates'=> count($txt) - 5
        );
    }
    
    /**
     * Uses sophie.zarb.org
    */
    function _fetch_source_packages()
    {
        $count = substr_count(
            file_get_contents('http://sophie.zarb.org/distrib/Mageia/cauldron/i586/srpms?json=1'),
            'pkgid'
        );
        
        return array(
            'count-srpms' => $count,
        );
    }

}