diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-06-02 18:15:26 +0200 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-06-02 18:15:26 +0200 |
commit | b30bb6f534e20f0a93a08c129ec41f7cc87e440a (patch) | |
tree | 0b0aaf0ebde8d97dce402f1a5cc7c8a10e1ba5b4 /web/lib/pkgfuncs.inc.php | |
parent | 019014a3acb6e10af11140082dfc319bd9d44fb3 (diff) | |
parent | e018670607ce6491163fbefb8eb84eec8588bf7b (diff) | |
download | aur-b30bb6f534e20f0a93a08c129ec41f7cc87e440a.tar.gz aur-b30bb6f534e20f0a93a08c129ec41f7cc87e440a.tar.xz |
Merge branch 'maint'
Diffstat (limited to 'web/lib/pkgfuncs.inc.php')
-rw-r--r-- | web/lib/pkgfuncs.inc.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index c35147fb..3bbf1a1e 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -942,3 +942,29 @@ 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 LEFT JOIN PackageBases ON "; + $q.= "PackageBases.ID = Packages.PackageBaseID "; + $q.= "ORDER BY SubmittedTS DESC "; + $q.= "LIMIT " . intval($numpkgs); + $result = $dbh->query($q); + + $packages = array(); + if ($result) { + while ($row = $result->fetch(PDO::FETCH_ASSOC)) { + $packages[] = $row; + } + } + + return $packages; +} |