blob: c02e68d7bf1fe553235ee91fa602c533a370e11b (
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
|
<?php
header('Content-Type: application/json;charset=utf-8');
require 'main.inc.php';
$name = $_GET['name'];
if ( !isset($name) || !$name ) {
$fedpkg = array('error' => 'No name provided');
} else {
$fedcli = new FedoraPkgdb();
$fedpkg = $fedcli->getPackageInfo($name);
if ( $fedpkg === false ) {
$fedpkg = array('error' => 'Unknown package');
} else {
//let's clean all little to avoid heavy json
foreach ( array_keys($fedpkg) as $k ) {
unset($fedpkg[$k]['specfile']);
unset($fedpkg[$k]['groups']);
unset($fedpkg[$k]['collection']);
unset($fedpkg[$k]['collectionid']);
unset($fedpkg[$k]['critpath']);
unset($fedpkg[$k]['qacontact']);
unset($fedpkg[$k]['statuschange']);
unset($fedpkg[$k]['statuscode']);
unset($fedpkg[$k]['id']);
unset($fedpkg[$k]['packageid']);
unset($fedpkg[$k]['package']['reviewurl']);
unset($fedpkg[$k]['package']['shouldopen']);
unset($fedpkg[$k]['package']['id']);
unset($fedpkg[$k]['package']['statuscode']);
unset($fedpkg[$k]['package']['upstreamurl']);
$people = $fedpkg[$k]['people'];
$new_people = null;
foreach( $people as $p ) {
$new_people[] = array(
'username' => $p['username'],
'aclOrder' => array(
'commit' => array(
'statuscode' => $p['aclOrder']['commit']['statuscode']
)
)
);
}
$fedpkg[$k]['people'] = $new_people;
}
}
}
echo json_encode($fedpkg);
?>
|