From patchwork Thu Jun 7 22:09:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nodiv Byzero X-Patchwork-Id: 586 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 9C5254AF5351 for ; Fri, 8 Jun 2018 05:09:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DATE_IN_PAST_06_12=1.103, DKIM_ADSP_CUSTOM_MED=0.001,DKIM_SIGNED=0.1,FREEMAIL_FROM=0.5, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,T_DKIM_INVALID=1 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] [127.0.0.10] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Fri, 8 Jun 2018 05:09:48 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 54A27B1BD98CB; Fri, 8 Jun 2018 05:09:42 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Fri, 8 Jun 2018 05:09:42 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2AA64214D5; Fri, 8 Jun 2018 05:09:42 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KrT8Bcr2 Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id E235A2DF5B for ; Fri, 8 Jun 2018 05:09:39 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Fri, 8 Jun 2018 05:09:39 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 3EA83B1BD98C8 for ; Fri, 8 Jun 2018 05:09:36 +0000 (UTC) Received: from mail-pg0-x236.google.com (mail-pg0-x236.google.com [IPv6:2607:f8b0:400e:c05::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Fri, 8 Jun 2018 05:09:35 +0000 (UTC) Received: by mail-pg0-x236.google.com with SMTP id l2-v6so5808015pgc.7 for ; Thu, 07 Jun 2018 22:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=zSx5JmaHd8Iq1xuDavJ3QnUyS4oDczO98R7IPSCRTyw=; b=KrT8Bcr2jGpR13eFugJT2SS7laGHrhVGc6zqK3MUQa7fGWxxgdtCXF+ANyWXCWPlV9 MYpSZ3acQ4ULaAkaYVrLy94RD/2YHFAGIawAvil/y/BpirfsCfv9JU+RhzAVYOSOhNNY NGr/ZjuWIcMtVhWvRZlyazflQv+3Eg1p6aO1rR5WTWwmGyaa6DAeELrdnHRm2w9UDx8L 0b/VeXC5u9f3HxuPwhy+4/cisqginSS1HR9fKVo6FoI8I6+ZtykufXstgbs7mSgmHyax EzgT61L7QcxzuZJl+swyfOEp5bvJ5LSwElj1PcumgmVZbEBdhr24MwSL5A1XkC5a2CxK zpzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zSx5JmaHd8Iq1xuDavJ3QnUyS4oDczO98R7IPSCRTyw=; b=naOkdoIby4dzSNl1ZHex8hEDci6eEOzEc32Ih9nb7yuMc04hIS8dL3Wvk4UEvhgRJK BlS/xNPf9SPLj9SQgbt3VnNC5Ds5vFk7O70IJVaEuqWu/gi9QdL3QeGk30K8tyBE6MHs 3iQZgcyyCQUqC4E9Mtc9RxWvPz+wU2Obw2QQeZJYYPDmGc6CfsXZyYSa6Jz4obaoeC28 50MZgJ435qI8v8rht1heqE7XLtvidhtgKNzt50G1zyMR4HN80BcYxI+0LIpD9ASLrAD6 Py3OFOdELmif9taRgsCpupWPWnCfNsxLB+f1Bi6RQz7K4JTozS7Qa1vnoi0nMdSSVs48 E7Rg== X-Gm-Message-State: APt69E3oxe6Yskmr2d5Ps+CaB17j3dmY24ERs6eNsaJ89qLht1s3R9vb +XXZrUHH04ioE3m0jc0ADAje6w== X-Google-Smtp-Source: ADUXVKL4mh9gVcMT1SMw9/HEPCcIDNN3DQpsr5m32O73qRJP8AiM3DiGiTBaWF8Z60eoc0fOFJlgbg== X-Received: by 2002:a62:6141:: with SMTP id v62-v6mr2930044pfb.197.1528434573809; Thu, 07 Jun 2018 22:09:33 -0700 (PDT) Received: from idev.vc.shawcable.net (S01060018e7de687b.vc.shawcable.net. [50.64.160.66]) by smtp.gmail.com with ESMTPSA id i71-v6sm18977716pgd.22.2018.06.07.22.09.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 22:09:33 -0700 (PDT) From: nodivbyzero To: aur-dev@archlinux.org Subject: [PATCH 1/1] This patch implements FS#54906. Ability to query by pkgver via RPC or web request (url) Date: Thu, 7 Jun 2018 22:09:22 +0000 Message-Id: <20180607220922.2455-1-nodivbyzero@gmail.com> X-Mailer: git-send-email 2.17.0 X-BeenThere: aur-dev@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Arch User Repository \(AUR\) Development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: aur-dev-bounces@archlinux.org Sender: "aur-dev" --- 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. */