mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Fix pkgbase_votes_from_name()
In 676595f
(Prefix package functions with pkg_/pkgbase_, 2014-04-05),
votes_for_pkgname() was renamed to pkgbase_votes_from_name() without
changing the semantics. Slightly adapt the implementation and interpret
the argument as a package base name instead of a package name. Also fix
the call site.
Reported-by: Felix Yan <felixonmars@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
e9b13cef3f
commit
d03f7a890f
2 changed files with 13 additions and 12 deletions
|
@ -683,19 +683,20 @@ function pkgbase_vote ($base_ids, $action=true) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all usernames and IDs that voted for a specific package
|
||||
* Get all usernames and IDs that voted for a specific package base
|
||||
*
|
||||
* @param string $pkgname The name of the package to retrieve votes for
|
||||
* @param string $pkgbase_name The package base to retrieve votes for
|
||||
*
|
||||
* @return array User IDs and usernames that voted for a specific package
|
||||
* @return array User IDs and usernames that voted for a specific package base
|
||||
*/
|
||||
function pkgbase_votes_from_name($pkgname) {
|
||||
function pkgbase_votes_from_name($pkgbase_name) {
|
||||
$dbh = DB::connect();
|
||||
|
||||
$q = "SELECT UsersID,Username,Name FROM PackageVotes ";
|
||||
$q.= "LEFT JOIN Users on (UsersID = Users.ID) ";
|
||||
$q.= "LEFT JOIN Packages on (PackageVotes.PackageBaseID = Packages.PackageBaseID) ";
|
||||
$q.= "WHERE Name = ". $dbh->quote($pkgname) . " ";
|
||||
$q = "SELECT UsersID, Username, Name FROM PackageVotes ";
|
||||
$q.= "LEFT JOIN Users ON UsersID = Users.ID ";
|
||||
$q.= "LEFT JOIN PackageBases ";
|
||||
$q.= "ON PackageVotes.PackageBaseID = PackageBases.ID ";
|
||||
$q.= "WHERE PackageBases.Name = ". $dbh->quote($pkgbase_name) . " ";
|
||||
$q.= "ORDER BY Username";
|
||||
$result = $dbh->query($q);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue