diff options
Diffstat (limited to 'list.php')
-rw-r--r-- | list.php | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/list.php b/list.php deleted file mode 100644 index 24340a8..0000000 --- a/list.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -require_once('conf.php'); - -$repo = []; - -$stmt = $db->prepare( - 'SELECT `package`.`id`,`package`.`name`,`url`,`desc`,`author`.`name` ' . - 'FROM `package`,`author` ' . - 'WHERE `package`.`author_id` = `author`.`id`'); -$stmt->execute(); -$stmt->bind_result($id, $name, $url, $desc, $author); -while ($stmt->fetch() === true) { - $repo[] = [ - 'id' => $id, - 'name' => $name, - 'author' => $author, - 'desc' => $desc, - 'url' => $url, - 'versions' => [] - ]; -} -$stmt->close(); - -$stmt = $db->prepare( - 'SELECT `major`,`minor`,`revision`,`depends` ' . - 'FROM `version` WHERE `package_id`=?'); -$stmt->bind_param('i', $pkg); -$stmt->bind_result($maj, $min, $rev, $deps); -for ($i = 0; $i < count($repo); $i++) { - $pkg = $repo[$i]['id']; - $stmt->execute(); - while ($stmt->fetch() === true) { - $repo[$i]['versions'][] = [ - 'version' => [$maj, $min, $rev], - 'depends' => json_decode($deps) - ]; - } - unset($repo[$i]['id']); -} - -print(json_encode($repo)); |