Commit graph

145 commits

Author SHA1 Message Date
Florian Pritz
f51d4c32cd Remove disjunction in pkg_providers query
For some reason, running the SELECT .. WHERE .. OR .. query takes e.g.
58ms on a randomly generated db for some dependency name. Splitting the
OR into two dedicated queries and UNIONing the result takes only 0.42ms.

On the Arch Linux installation, searching for the providers of e.g.
mongodb takes >=110ms when not cached by the query cache. The new query
takes <1ms even when not cached.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-02-24 14:57:31 +01:00
Eli Schwartz
ac29097ce8 Fix regression that stopped maintainers from pinning comments
In commit 8c98db0b82 support was added for
package co-maintainers to pin comments in addition to maintainers.

Due to a typo, the SQL query was reset halfway through and only added
the co-maintainer IDs to the list of allowed users.

Fixes FS#56783.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-12-23 22:51:39 +01:00
Lukas Fleischer
8c98db0b82 Allow package co-maintainers to pin comments
Implements FS#56255.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-06 17:03:37 +01:00
Lukas Fleischer
44858e0618 Store dependency descriptions in a separate column
Split optional dependency descriptions from dependency names before
storing them in the database and use a separate column to store the
descriptions.

This allows us to simplify and optimize the SQL queries in
pkg_dependencies() as well as pkg_required().

Suggested-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-19 09:13:09 +02:00
Janne Heß
9df1bd5fe2 Add direct links to each source file
Currently, each source file which is an external link (http://,
https://, ...) is a clickable link.

This commit extends the behaviour by making files from the repository
clickable as well. The link brings the user to the corresponding cgit
page.

Also, the link to the PKGBUILD is altered to make the configuration more
consistent.

Signed-off-by: Janne Heß <jannehess@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-02-12 17:53:13 +01:00
Lukas Fleischer
880d25e98c Allow to search for both maintainer and co-maintainer
As a follow-up to commit 6cb8c04 (Implement co-maintainer search,
2017-01-26), add an option to search for both maintainers and
co-maintainers at the same time.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-02-08 19:18:27 +01:00
Lukas Fleischer
555cdac2db Return the number of results in pkg_search_page()
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-02-08 19:18:26 +01:00
Lukas Fleischer
3b4c6e72a9 Refactor pkg_search_page()
* Pass search parameters using an associative array instead of $_GET.
* Add a boolean parameter to enable and disable headers/footers.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-02-04 00:36:17 +01:00
Lukas Fleischer
ac745f656d Split out the search form from pkg_search_page()
This makes it easier to display search results without showing the
search form.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-02-03 23:54:31 +01:00
Lukas Fleischer
6cb8c041bc Implement co-maintainer search
Add an option to filter package search results by co-maintainer.

Partly fixes FS#45591.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-01-28 11:23:40 +01:00
Lukas Fleischer
fbf3e54057 Add hard limit for the length of dependency lists
Introduce a configuration option max_depends which can be used to
specify a maximum number of (reverse) dependencies to display on the
package details pages.

Fixes FS#49059.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-06-26 08:53:55 +02:00
Mark Weiman
c23914fc1d Unset $pinned unconditionally when displaying comments
In pkg_comments.php, the $pinned variable is used to determine whether
the template is supposed to print all comments or pinned comments only.
If the $pinned variable is unset, the top 10 comments are printed,
followed by an "All comments" link. If the $pinned variable is set, the
pinned comments are printed and the "All comments" link below the
comment listing is skipped. Thus, we need to make sure that this
variable is always unset at the time we include the template to display
all comments, even if it was empty before.

Fixes FS#48194.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-02-19 18:18:48 +01:00
Lukas Fleischer
3412de21d3 Rename the CommentNotify table to PackageNotifications
As a preparatory step to adding support for package notifications on
events other than comments, rename the database table accordingly.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-02-07 10:39:22 +01:00
Mark Weiman
7d4c0c9ffa Implement capability to pin comments above others
Adds capability to pin comments before others.

Implements FS#10863.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-12-12 15:09:47 +01:00
Lukas Fleischer
66d12f0c37 Highlight broken dependencies
If a dependency neither exists in the official repositories nor in the
AUR, make it appear bold red.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-24 18:59:04 +02:00
Lukas Fleischer
8dcf225f63 Hide optdepend description if not available
Remove the "(unknown)" suffix that used to be shown for optional
dependencies without a description.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-24 18:50:44 +02:00
Lukas Fleischer
b30135111a Include trivial AUR providers in pkg_providers()
When obtaining provisions using pkg_providers(), we already include
virtual providers from the official repositories, virtual providers from
the AUR and trivial providers (i.e. packages having the given name) from
the official repositories. Include trivial providers from the AUR as
well.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-24 18:33:00 +02:00
Lukas Fleischer
5d119c02ea Always retrieve dependency providers
Since commit 16765d5 (Track providers in the official repositories,
2015-10-21), we know all packages and virtual provisions from the
official repositories. Always obtain and display all providers from both
the official repositories and the AUR.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-24 18:22:25 +02:00
Lukas Fleischer
b74a87abfc Fix spacing of versioned dependencies
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-24 18:13:48 +02:00
Lukas Fleischer
16765d5532 Track providers in the official repositories
Maintain a list of virtual provisions of packages from the official
binary package repositories. The list can be updated using the aurblup
script, e.g. via a cronjob.

This allows for adding proper links to package dependencies: If an AUR
package depends on a package from the official repositories (or on a
name provided by a package from the official repositories), add a link
to the corresponding archweb package details page. If an AUR package
depends on another AUR package (or on a name provided by another AUR
package), add a link to the corresponding aurweb package details page.
Otherwise, just display the name and do not add a link at all.

Fixes FS#46549.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-21 22:05:42 +02:00
Lukas Fleischer
938b1058eb pkgfuncs.inc.php: Squelch PHP warning
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-25 08:35:44 +02:00
Marcel Korpel
4516f07d9c Add search for keywords only
Implements FS#45619.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-23 21:45:47 +02:00
Lukas Fleischer
f3ec4d1ef5 Rename "Age" search order to "Last modified"
Use a better description for sorting by modification time, as it is not
clear whether "Age" refers to the package creation date or to the
modification date.

The possibility to sort by "Age" is kept internally (but hidden from the
user interface) such that old links to search results still work.

Fixes FS#46319.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-20 11:09:47 +02:00
Lukas Fleischer
9cae17ff7c 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>
2015-09-18 08:03:56 +02:00
Lukas Fleischer
0dd27a86b1 Remove legacy code
In 74edb6f (Use Git repositories to store packages, 2014-06-06), package
creation was moved to the Python backend. Remove several PHP functions
that are no longer needed.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-18 07:55:50 +02:00
Lukas Fleischer
9d2d8f1c8c Honor virtual provisions in package requirements
Implements FS#14125.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-17 23:04:58 +02:00
Lukas Fleischer
dd808ac802 Use a separate function for "Required by" links
Do not use the same function for generating dependency and inverse
dependency links. Instead, factor out common code and create two
separate functions for those (rather different) functionalities.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-17 19:06:18 +02:00
Lukas Fleischer
f9476c1093 Show providers in dependencies
For all "virtual provisions" in package dependencies, show links to the
actual packages providing the dependency.

This partly implements FS#14125.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-16 22:00:04 +02:00
Lukas Fleischer
57db4814a4 Allow users to unflag packages they flagged themselves
Sometimes, a user accidentally flags a package out-of-date. Allow users
to unflag packages that they flagged themselves, thereby providing a way
to undo these actions.

Implements FS#46145.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-30 16:51:14 +02:00
Marcel Korpel
c7025054c6 Split pkg_comment_form.php so the outer box is not always included
For use in the new RPC interface to edit comments, the form shouldn't
always print a header. Create a new template pkg_comment_box.php that
prints form and box, change template pkg_comment_form.php to only
print the form.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Lukas Fleischer
e610360c95 Show popularity in package base details
Fixes FS#45600.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Marcel Korpel
e331ce273c Support comment editing in the backend
Create two new actions, do_AddComment and do_EditComment. When editing
or deleting a comment, a timestamp is added.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Marcel Korpel
92e19e95f3 Add comment edit icon and form
Show an icon next to the comment deletion icon, which leads to a
comment edit form.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:23 +02:00
Lukas Fleischer
d1c331613d Display (reverse) optional dependencies as "Required by"
Also, change pkg_required() such that the returned array has the same
structure as the result of pkg_dependencies().

Fixes FS#45452.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Lukas Fleischer
2d7b68ac4c Remove can_submit_blacklisted()
This function is unneeded since commit 74edb6f (Use Git repositories to
store packages, 2014-06-06).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-19 16:52:07 +02:00
Lukas Fleischer
5fb7a74e23 Replace categories with keywords
Remove package base categories. Instead, users can now specify up to
twenty custom keywords that are taken into consideration when searching.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-14 17:58:55 +02:00
Lukas Fleischer
15ee85b456 Show package popularity in search results
Display the popularity score (weighted votes) in the package search
results.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-11 19:15:44 +02:00
Lukas Fleischer
08cdc5ca64 Invert order when sorting packages by age
Fixes FS#44195.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-09 09:22:46 +02:00
Lukas Fleischer
5c64ae1a0e Drop suffixes from confirm parameters
Remove the _delete and _disown suffixes from HTTP POST confirmation
parameters.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-09 09:05:05 +02:00
Lukas Fleischer
8aa4c51dfb Fix searching for an empty string
Return all packages when an empty search term is used with keyword
search.

Reported-by: G. Schlisio <g.schlisio@dukun.de>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 21:35:52 +02:00
Lukas Fleischer
643dae80eb pkgfuncs.inc.php: Remove a conflict marker
Remove a Git conflict marker that was added accidentally in 74edb6f (Use
Git repositories to store packages, 2014-06-06).

Reported-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-04 11:24:56 +02:00
Lukas Fleischer
2db1a55922 Support boolean operators in search queries
This adds very basic support for boolean search queries such as "video
or movie" or "lin and not linux". However, nested queries such as
"(video or movie) and editing" are not (yet) supported.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-22 17:09:26 +02:00
Lukas Fleischer
0f48341ed6 Do not allow more than 20 terms in search queries
Specifying a huge number of search terms currently results in complex
SQL queries. In practice, queries with more than 20 terms are rarely
needed. Ignore everything apart from the first 20 keywords to prevent
from potential abuse.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-22 17:09:25 +02:00
Lukas Fleischer
20b838a90c Use keyword search by default
Change the default search mode such that packages that contain all of
the space-separated search terms are returned. For example, the query

    image edit "command line"

returns all packages where "image", "edit" and "command line" occurs in
the package name or description. This is much more convenient and
general than a simple substring search (one can still perform a
substring search by quoting the whole search term).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-22 13:08:06 +02:00
Lukas Fleischer
d1df490370 Hide fresh package bases from stats and results
Do not show package bases that have just been created in the package
update statistics or in the search results.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-12-28 17:44:25 +01:00
Lukas Fleischer
74edb6fea9 Use Git repositories to store packages
* Remove package submission page from the web interface.
* Replace PKGBUILD and tarball links with links to cgit.
* Remove the "URLPath" field from RPC replies.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-12-27 12:42:12 +01:00
Lukas Fleischer
571b74b901 Always use virtual URLs
Support for non-virtual URLs has been broken for a long time and is no
longer used on the official AUR setup.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-11-21 11:43:31 +01:00
Lukas Fleischer
76343fb915 Use an INI-style configuration file
Replace web/lib/config.inc.php with an INI-style configuration file.
This allows us to get rid of several globals and makes it easier to use
the same configuration file in external scripts.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-10-24 10:03:54 +02:00
Lukas Fleischer
a1bee1a21e Add support for architecture-specific sources
As a follow-up to 4d7da95 (Add support for architecture-specific fields,
2014-08-10), handle architecture-specific source fields as well.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-10-10 12:29:18 +02:00
Lukas Fleischer
4d7da95906 Add support for architecture-specific fields
This adds support for architecture-specific dependencies and relations.
Support for this has recently been added to makepkg, see commit 2b556d8
(PKGBUILD: handle arch specific attributes, 2014-07-25) in the pacman
repository for details.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-08-10 12:32:46 +02:00