[aur-dev] [PATCH 1/2] Move latest_pkgs() to pkgfuncs.inc.php
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/lib/aur.inc.php | 24 ------------------------ web/lib/pkgfuncs.inc.php | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index ff46455..99f5ae4 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -550,30 +550,6 @@ function end_atomic_commit() { } /** - * 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; -} - -/** * Merge pkgbase and package options * * Merges entries of the first and the second array. If any key appears in both diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index c35147f..a43512c 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; +} -- 1.9.3
This fixes a regression introduced when adding split package support and makes the RSS feed work again. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/lib/pkgfuncs.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index a43512c..3bbf1a1 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -953,11 +953,13 @@ function pkg_add_lic($pkgid, $licid) { function latest_pkgs($numpkgs) { $dbh = DB::connect(); - $q = "SELECT * FROM Packages "; + $q = "SELECT * FROM Packages LEFT JOIN PackageBases ON "; + $q.= "PackageBases.ID = Packages.PackageBaseID "; $q.= "ORDER BY SubmittedTS DESC "; - $q.= "LIMIT " .intval($numpkgs); + $q.= "LIMIT " . intval($numpkgs); $result = $dbh->query($q); + $packages = array(); if ($result) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $packages[] = $row; -- 1.9.3
participants (1)
-
Lukas Fleischer