[PATCH 1/1] This patch implements FS#54906. Ability to query by pkgver via RPC or web request (url)
nodivbyzero
nodivbyzero at gmail.com
Thu Jun 7 22:09:22 UTC 2018
---
web/lib/aurjson.class.php | 5 +++++
web/lib/pkgfuncs.inc.php | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index c51e9c2..30ce63f 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -486,6 +486,11 @@ class AurJSON {
if ($search_by === 'name') {
$where_condition = "(Packages.Name LIKE $keyword_string)";
+ if (isset($http_data['pkgver'])) {
+ $pkgver = $http_data['pkgver'];
+ $pkgver_string = $this->dbh->quote($pkgver . "%");
+ $where_condition .= " AND (Packages.Version LIKE $pkgver_string)";
+ }
} else if ($search_by === 'name-desc') {
$where_condition = "(Packages.Name LIKE $keyword_string OR ";
$where_condition .= "Description LIKE $keyword_string)";
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index ad25474..660e3f5 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -727,6 +727,10 @@ function pkg_search_page($params, $show_headers=true, $SID="") {
/* Search by name. */
$K = "%" . addcslashes($params['K'], '%_') . "%";
$q_where .= "AND (Packages.Name LIKE " . $dbh->quote($K) . ") ";
+ if (isset($params["pkgver"])) {
+ $pkgver = $params["pkgver"];
+ $q_where .= "AND (Packages.Version LIKE " . $dbh->quote($pkgver . "%") . ") ";
+ }
}
elseif (isset($params["SeB"]) && $params["SeB"] == "b") {
/* Search by package base name. */
--
2.17.0
More information about the aur-dev
mailing list