summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc.php
AgeCommit message (Collapse)AuthorFilesLines
2019-10-09Cache package requirements and sourcesLukas Fleischer1-19/+9
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2019-10-07Make package details cache TTL configurableLukas Fleischer1-5/+10
The TTL for package details can be much longer than for generic values since they never change. Note that when an update is pushed via Git, all packages belonging to that package base are deleted and new packages are created. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2019-10-07Cache package licenses, groups and relationsLukas Fleischer1-44/+22
Cache more package details if the global caching mechanism is enabled. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2019-10-06Cache package provider and dependency informationLukas Fleischer1-29/+11
The package provider and dependency queries are quite CPU-intensive and usually yield rather small result sets. Cache these values if the global caching mechanism is enabled. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2019-01-14Quote MySql 8.0 reserved keywordsFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2018-08-06Allow paginating package commentsJohannes Löthberg1-2/+3
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-08-06Allow listing all comments from a userJohannes Löthberg1-0/+4
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-02-24Remove disjunction in pkg_providers queryFlorian Pritz1-2/+4
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>
2017-12-23Fix regression that stopped maintainers from pinning commentsEli Schwartz1-1/+1
In commit 8c98db0b82cc85a4498589e5d60299fefd93b421 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-11-06Allow package co-maintainers to pin commentsLukas Fleischer1-6/+13
Implements FS#56255. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-19Store dependency descriptions in a separate columnLukas Fleischer1-25/+8
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-02-12Add direct links to each source fileJanne Heß1-2/+4
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-08Allow to search for both maintainer and co-maintainerLukas Fleischer1-0/+8
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-08Return the number of results in pkg_search_page()Lukas Fleischer1-2/+2
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-02-04Refactor pkg_search_page()Lukas Fleischer1-83/+47
* 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-03Split out the search form from pkg_search_page()Lukas Fleischer1-2/+0
This makes it easier to display search results without showing the search form. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-01-28Implement co-maintainer searchLukas Fleischer1-0/+8
Add an option to filter package search results by co-maintainer. Partly fixes FS#45591. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-06-26Add hard limit for the length of dependency listsLukas Fleischer1-4/+6
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-02-19Unset $pinned unconditionally when displaying commentsMark Weiman1-1/+1
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-07Rename the CommentNotify table to PackageNotificationsLukas Fleischer1-3/+3
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>
2015-12-12Implement capability to pin comments above othersMark Weiman1-1/+50
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-10-24Highlight broken dependenciesLukas Fleischer1-0/+9
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-24Hide optdepend description if not availableLukas Fleischer1-1/+1
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-24Include trivial AUR providers in pkg_providers()Lukas Fleischer1-4/+5
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-24Always retrieve dependency providersLukas Fleischer1-11/+8
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-24Fix spacing of versioned dependenciesLukas Fleischer1-1/+1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-21Track providers in the official repositoriesLukas Fleischer1-16/+48
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-09-25pkgfuncs.inc.php: Squelch PHP warningLukas Fleischer1-0/+1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-23Add search for keywords onlyMarcel Korpel1-39/+64
Implements FS#45619. Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-20Rename "Age" search order to "Last modified"Lukas Fleischer1-0/+4
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-18Extract package name from detailsLukas Fleischer1-36/+0
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-18Remove legacy codeLukas Fleischer1-189/+0
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-17Honor virtual provisions in package requirementsLukas Fleischer1-5/+26
Implements FS#14125. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-17Use a separate function for "Required by" linksLukas Fleischer1-27/+65
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-16Show providers in dependenciesLukas Fleischer1-6/+59
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-08-30Allow users to unflag packages they flagged themselvesLukas Fleischer1-1/+1
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-08Split pkg_comment_form.php so the outer box is not always includedMarcel Korpel1-1/+1
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-08Show popularity in package base detailsLukas Fleischer1-2/+2
Fixes FS#45600. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08Support comment editing in the backendMarcel Korpel1-0/+26
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-08Add comment edit icon and formMarcel Korpel1-0/+14
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-06-27Display (reverse) optional dependencies as "Required by"Lukas Fleischer1-5/+8
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-19Remove can_submit_blacklisted()Lukas Fleischer1-12/+0
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-14Replace categories with keywordsLukas Fleischer1-24/+10
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-11Show package popularity in search resultsLukas Fleischer1-2/+5
Display the popularity score (weighted votes) in the package search results. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-09Invert order when sorting packages by ageLukas Fleischer1-1/+1
Fixes FS#44195. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-09Drop suffixes from confirm parametersLukas Fleischer1-1/+1
Remove the _delete and _disown suffixes from HTTP POST confirmation parameters. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08Fix searching for an empty stringLukas Fleischer1-4/+6
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-04pkgfuncs.inc.php: Remove a conflict markerLukas Fleischer1-1/+0
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-05-22Support boolean operators in search queriesLukas Fleischer1-1/+18
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-22Do not allow more than 20 terms in search queriesLukas Fleischer1-0/+11
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>