summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib/pkgfuncs.inc.php')
-rw-r--r--web/lib/pkgfuncs.inc.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index c35147fb..a43512c3 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -942,3 +942,27 @@ function pkg_add_lic($pkgid, $licid) {
);
$dbh->exec($q);
}
+
+/**
+ * Determine package information for latest package
+ *
+ * @param int $numpkgs Number of packages to get information on
+ *
+ * @return array $packages Package info for the specified number of recent packages
+ */
+function latest_pkgs($numpkgs) {
+ $dbh = DB::connect();
+
+ $q = "SELECT * FROM Packages ";
+ $q.= "ORDER BY SubmittedTS DESC ";
+ $q.= "LIMIT " .intval($numpkgs);
+ $result = $dbh->query($q);
+
+ if ($result) {
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
+ $packages[] = $row;
+ }
+ }
+
+ return $packages;
+}