summaryrefslogtreecommitdiffstats
path: root/pkgdb-ajax.php
diff options
context:
space:
mode:
Diffstat (limited to 'pkgdb-ajax.php')
-rw-r--r--pkgdb-ajax.php49
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