mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Display package groups on the details page
The groups field is hidden if a package doesn't belong to any group. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
cc3244ea8a
commit
38eb8d2a3a
2 changed files with 44 additions and 0 deletions
|
@ -104,6 +104,32 @@ function pkg_from_name($name="") {
|
|||
return $row[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get package groups for a specific package
|
||||
*
|
||||
* @param int $pkgid The package to get groups for
|
||||
*
|
||||
* @return array All package groups for the package
|
||||
*/
|
||||
function pkg_groups($pkgid) {
|
||||
$grps = array();
|
||||
$pkgid = intval($pkgid);
|
||||
if ($pkgid > 0) {
|
||||
$dbh = DB::connect();
|
||||
$q = "SELECT g.Name FROM Groups g ";
|
||||
$q.= "INNER JOIN PackageGroups pg ON pg.GroupID = g.ID ";
|
||||
$q.= "WHERE pg.PackageID = ". $pkgid;
|
||||
$result = $dbh->query($q);
|
||||
if (!$result) {
|
||||
return array();
|
||||
}
|
||||
while ($row = $result->fetch(PDO::FETCH_COLUMN, 0)) {
|
||||
$grps[] = $row;
|
||||
}
|
||||
}
|
||||
return $grps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get package dependencies for a specific package
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue