mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Move latest_pkgs() to pkgfuncs.inc.php
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
86de2e5628
commit
44268778c8
2 changed files with 24 additions and 24 deletions
|
@ -549,30 +549,6 @@ function end_atomic_commit() {
|
|||
$dbh->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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue