summaryrefslogtreecommitdiffstats
path: root/web/html
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-04-12 03:39:01 +0200
committerLoui Chang <louipc.ist@gmail.com>2009-04-13 16:07:46 +0200
commit55da4d4e0de8b6fbaee38105b6531ec9a4032d4f (patch)
treec2b06dd5560ecd3907af5fa8e8e3dfadd65b0240 /web/html
parentf028d5c1409c1083e742fceeb1651cce7fd54ec2 (diff)
downloadaur-55da4d4e0de8b6fbaee38105b6531ec9a4032d4f.tar.gz
aur-55da4d4e0de8b6fbaee38105b6531ec9a4032d4f.tar.xz
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>
Diffstat (limited to 'web/html')
-rw-r--r--web/html/pkgedit.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/web/html/pkgedit.php b/web/html/pkgedit.php
index 3b1c8257..5a711d04 100644
--- a/web/html/pkgedit.php
+++ b/web/html/pkgedit.php
@@ -35,9 +35,9 @@ if (!$_REQUEST["ID"]) {
#
if ($_REQUEST["del_Comment"]) {
if ($_REQUEST["comment_id"]) {
- if (canDeleteComment($_REQUEST["comment_id"], $atype, $_COOKIE["AURSID"])) {
+ $uid = uid_from_sid($_COOKIE["AURSID"]);
+ if (canDeleteComment($_REQUEST["comment_id"], $atype, $uid)) {
$dbh = db_connect();
- $uid = uid_from_sid($_COOKIE["AURSID"]);
$q = "UPDATE PackageComments ";
$q.= "SET DelUsersID = ".$uid." ";
$q.= "WHERE ID = ".intval($_REQUEST["comment_id"]);