Commit graph

181 commits

Author SHA1 Message Date
Lukas Fleischer
1c55e6b40c Add option to search for exact name matches only (fixes FS#23556).
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-06 19:21:19 +02:00
Lukas Fleischer
8cd2aef50d Initialize "$name" in pkgname_from_id().
Ensures "$name" is always initialized, even if the package doesn't
exist. Fixes PHP warnings appearing when retrieving package details of a
package with an invalid ID.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-05 11:38:43 +02:00
Dan McGee
7c91c59245 Remove Dummy Package concept
Instead, we just store dependencies directly in the PackageDepends
table. Since we don't use this info anywhere besides the package details
page, there is little value in precalculating what is in the AUR vs.
what is not.

An upgrade path is provided via several SQL statements in the UPGRADING
document. There should be no user-visible change from this, but the DB
schema gets a bit more sane and we no longer have loads of junk packages
in our tables that are never shown to the end user. This should also
help the MySQL query planner in several cases as we no longer have to be
careful to exclude dummy packages on every query.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-03 22:59:32 +02:00
Dan McGee
1f252eba64 Always set ModifiedTS including new packages
Set it equal to the SubmittedTS field, which will be our indication the
package is new when we show the logo on the front page of the AUR.

This results in the ability to remove the use of the unindexable
GREATEST() function from the AUR code everywhere we had to use it before
to handle the 0 timestamp case.

Note that there is no race condition here in calling UNIX_TIMESTAMP()
twice- it always returns the time at the beginning of statment
execution:

    mysql> select unix_timestamp(), sleep(2), unix_timestamp();
    +------------------+----------+------------------+
    | unix_timestamp() | sleep(2) | unix_timestamp() |
    +------------------+----------+------------------+
    |       1300851746 |        0 |       1300851746 |
    +------------------+----------+------------------+
    1 row in set (2.00 sec)

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-03 22:59:31 +02:00
Dan McGee
b6a34d013b Bump up default per-page value to 50
25 is woefully small for the number of packages many searches can
return, and with 28000+ packages in AUR, it makes sense to show a lot
more per page by default.

The new choices of (50, 100, 250) happen to match those from the main
site.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-24 15:32:08 +01:00
Lukas Fleischer
bd36412321 Fix searching for orphans with "$LANG != 'en'" (fixes FS#23252).
Regression introduced in commit ef8fab0c. Removed the strict check again
instead of wrapping it in __() to ensure search URLs are language
independent.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-12 19:54:35 +01:00
Dan McGee
c34bebf428 Perform a second query to find total search count
This removes the need for SQL_CALC_FOUND_ROWS which can really slow down
queries in a lot of cases. The COUNT(*) query we end up performing can
reuse a lot of the original clauses from our primary query, but we can
really slim it up by omitting some joins and the sorting/limiting
clauses.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-10 18:16:00 +01:00
Dan McGee
2cfcddf24e Split package search query into parts
No functional change here; we should be rebuilding the same query at the
end of the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-10 18:16:00 +01:00
Dan McGee
d186bcfd89 Add a sanitize_ids function and use it in all pkg_* functions
And use implode() instead of some looping/first time logic.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:18 +01:00
Dan McGee
ddbe6d0d33 Remove dead dependency/required by link code
For some reason we were doing this song and dance "iterate all the known
parameters" business. This is totally unnecessary, clutters the links,
and was spewing errors all over the place, so kill it.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:17 +01:00
Dan McGee
ef8fab0c12 Ensure all variables are set in package search form
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:16 +01:00
Dan McGee
d1d0288598 Add action lookup helper function
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:15 +01:00
Dan McGee
bbc90846f5 Ensure all package ID values are coerced to integers
We don't need mysql_real_escape_string(), we need valid integer
conversions.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:15 +01:00
Dan McGee
0e30410767 Vastly simplify pkg_delete function
Since only TUs/Devs can delete packages, we can remove almost all checks
except the account type check. And now that our DB uses foreign keys,
all of the other deletes happen implicitly when a package is deleted so
we don't need to take care of it here.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:14 +01:00
Lukas Fleischer
1e3fa38de5 Define "Packages.SubmitterUID" and "Packages.MaintainerUID" as "NULL".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-27 19:46:19 +01:00
Lukas Fleischer
40ccf77ca0 Define "PackageComments.DelUsersID" as "NULL".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-27 16:20:02 +01:00
Lukas Fleischer
c39183c3ee Add ability to search for non-out-of-date packages (fixes FS#17896).
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-22 18:33:27 +01:00
Wieland Hoffmann
743cffe7d1 Fix typo in "web/lib/pkgfuncs.inc".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-21 18:56:38 +01:00
PyroPeter
1fdecbd5a4 pkg_search_results: rewrite of pagination
* Most of the PHP-code was moved to pkgfuncs.php to keep the template simple.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-17 18:54:26 +01:00
Lukas Fleischer
b69f548065 Add a package name blacklist.
Can be used to blacklist package names for normal users. TUs and
developers are not affected. This is especially useful if used together
with a cron job that updates the blacklist periodically, e.g. to reject
packages which are available in the binary repos (FS#12902).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-11 14:43:22 +01:00
Lukas Fleischer
0e0e80aeea Minor bugfix in pkg_change_category().
This cleans up some broken MySQL query introduced by commit 57a5cbfd.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-09 08:58:44 +01:00
Dan McGee
7f5af61c88 Drop PackageLocations table and references
We don't need this anymore since all packages managed here are
well...managed here. Rip out all of the places we were using this field,
many of which depended on the magic value '2' anyway.

On the display side of things, we had a column that was always showing
'unsupported' that is now gone, and you can no longer sort by this column.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-01 12:41:08 +01:00
Dan Vratil
57a5cbfd88 Auto redirect from confirmation screens.
Finally move comment deletion and category editing into functions and
remove pkgedit.php

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
-Fix indentation
-Fix variable naming conflict $id vs $cid
2010-11-21 03:37:17 -05:00
Lukas Fleischer
eda713032c Add timestamp when a package is flagged out-of-date (FS#20848).
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
- resolve conflict and omit i18n changes.
2010-11-10 14:50:35 -05:00
Lukas Fleischer
b5bc6ab742 Confirmation when deleting packages
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-07-01 21:19:18 -04:00
Lukas Fleischer
b18fb08ddc Add sorting by "Voted" and "Notify" fields
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-06-04 18:22:22 -04:00
Loui Chang
5b8b0757f4 pkg_comments: Only display 10 comments by default.
Add a mechanism to view all comments.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-04-15 16:52:55 -04:00
Andrea Scarpino
24599ab6e3 add search only by name
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-04-15 15:26:20 -04:00
Andrea Scarpino
74f22eeb2a remove empty To field (FS#17584)
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-03-29 20:20:40 -04:00
Andrea Scarpino
13cd9591be Turn on package notification for adopted packages
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-03-15 22:20:08 -04:00
Andrea Scarpino
5091b11dad add link to account profile in out-of-date notification
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-03-10 18:58:47 -05:00
Dan McGee
1ceeda8ab5 Specify explicit joins for package search
Refactor the query to use explicit LEFT JOINs, which appears to be handled
by MySQL in a saner fashion than the previous implicit join syntax. This is
part two in a slight fixup for observed slow queries in the production
environment. With the new indexes and this fixup, a particular iteration of
this query will examine only 13346 rows instead of 272060.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-06-18 01:47:17 -04:00
Dan McGee
55da4d4e0d Don't hit the database twice per comment on package
It's performance improvement day today. For non-superusers, we were hitting
the database twice per comment on a package- once to get the UID, and once
to check the owner of the comment. The best part is we already knew the
owner of the comment, and we only need to get our own UID once.

For viewing a package like yaourt, this cuts a single pageview from over 700
queries to around 18, which is still not great but a pretty big improvement.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-04-13 10:07:46 -04:00
Loui Chang
9c98047f86 Fix search output if no results are found.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-03-03 13:22:53 -05:00
Loui Chang
3c1b84bc7e Go to details page when a search returns one result.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-03-03 12:55:14 -05:00
Loui Chang
c949296a08 pkgfuncs.inc: Fix indentation.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-03-03 12:11:49 -05:00
Loui Chang
bbc05414cf Update cleanup script to remove non-unsupported files.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-03-03 11:21:08 -05:00
Loui Chang
402c6d0933 Fix the comment poop bug.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-02-20 20:59:07 -05:00
Andrea Scarpino
84f08cf82b Add 'Out of Date' detail in search form
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-02-18 09:31:20 -05:00
Loui Chang
354c86b6c6 Move package comment form into a new template.
Feature the form on the package details page.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-25 13:17:54 -05:00
Loui Chang
b31b4ec03e Add package details template (pkg_details.php)
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-24 01:22:19 -05:00
Loui Chang
ff3a29ea07 Move actions form into template.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-23 18:25:41 -05:00
Loui Chang
2ee3276348 Use new conglomerated translation files.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-19 16:29:45 -05:00
Loui Chang
36b44f371b Move package comments to a template.
Change layout in the process.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-05 15:59:59 -05:00
Dan McGee
207b565f1c Minimize calls to uid_from_sid()
Just like the previous patch for account_from_sid() over-usage.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-04 14:28:24 -05:00
Dan McGee
8f97330100 Store account type in local var when possible
No need to call this function way too often, especially when on the package
list page where it could be called up to once per row.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-04 14:09:53 -05:00
Callan Barrett
a16f4c77b3 Make search page use mkurl function, change variables around
Changed all the normal variables to their $_GET counterparts so everything is destructively changing the original variables, there should be no issue with this. If there I guess we need to consider making mkurl use a custom array of variables rather than $_GET

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-12-29 17:33:19 -05:00
Callan Barrett
b4a62c4915 Move package search results to a template
Logic is separated from html as much as possible, all html in a template

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-12-21 12:44:31 -05:00
Loui Chang
78c2b5c67f Introduce function include_lang for translations.
This includes only the requested language for each page and
makes top level language include files obsolete.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-12-21 18:03:27 +09:00
Loui Chang
cfeb080dcd Make all web paths relative.
The site no longer needs to be hosted from the
root of a domain, or virtual host.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
2008-12-21 15:24:57 +09:00