summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc.php
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-09-18 08:02:33 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-09-18 08:03:56 +0200
commit9cae17ff7c4eeb7af66e06ba38de3b64d08dec2f (patch)
tree20bcb5a4aecc915bca4d9ace0c69671a9daddcd3 /web/lib/pkgfuncs.inc.php
parent0dd27a86b1bceaa01d406e4b85139acbd8c885ab (diff)
downloadaur-9cae17ff7c4eeb7af66e06ba38de3b64d08dec2f.tar.gz
aur-9cae17ff7c4eeb7af66e06ba38de3b64d08dec2f.tar.xz
Extract package name from details
When requesting package details, instead of performing another SQL query to obtain the package name, extract the name from the result of the package details query. Also, drop pkg_name_from_id() which is no longer needed after this optimization. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/pkgfuncs.inc.php')
-rw-r--r--web/lib/pkgfuncs.inc.php36
1 files changed, 0 insertions, 36 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index d3cad12f..62bea652 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -480,42 +480,6 @@ function pkg_sources($pkgid) {
}
/**
- * Determine package names from package IDs
- *
- * @param string|array $pkgids The package IDs to get names for
- *
- * @return array|string All names if multiple package IDs, otherwise package name
- */
-function pkg_name_from_id($pkgids) {
- if (is_array($pkgids)) {
- $pkgids = sanitize_ids($pkgids);
- $names = array();
- $dbh = DB::connect();
- $q = "SELECT Name FROM Packages WHERE ID IN (";
- $q.= implode(",", $pkgids) . ")";
- $result = $dbh->query($q);
- if ($result) {
- while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
- $names[] = $row['Name'];
- }
- }
- return $names;
- }
- elseif ($pkgids > 0) {
- $dbh = DB::connect();
- $q = "SELECT Name FROM Packages WHERE ID = " . $pkgids;
- $result = $dbh->query($q);
- if ($result) {
- $name = $result->fetch(PDO::FETCH_NUM);
- }
- return $name[0];
- }
- else {
- return NULL;
- }
-}
-
-/**
* Get the package details
*
* @param string $id The package ID to get description for