diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-05-30 08:40:54 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-05-30 08:40:54 +0200 |
commit | b2955d2b93937913334580dfad856e7b5c18c613 (patch) | |
tree | f788f81c482ba4c8aa9564a7d17c575c5f809ff5 /pkgdb-ajax.php | |
parent | 2c61a7ac0a3cfc86f74031ba6ec41ea81d4a8fcc (diff) | |
parent | caa9d9178232885b7e02aab8be94e01e438cc1d7 (diff) |
Merge branch 'master' of http://github.com/trasher/rpmphp
Diffstat (limited to 'pkgdb-ajax.php')
-rw-r--r-- | pkgdb-ajax.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/pkgdb-ajax.php b/pkgdb-ajax.php new file mode 100644 index 0000000..5cff16c --- /dev/null +++ b/pkgdb-ajax.php @@ -0,0 +1,49 @@ +<?php +header('Content-Type: application/json;charset=utf-8'); +require 'FedoraClient.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); +?>
\ No newline at end of file |