diff options
author | Dan McGee <dan@archlinux.org> | 2009-04-11 20:39:01 -0500 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2009-04-13 10:07:46 -0400 |
commit | 55da4d4e0de8b6fbaee38105b6531ec9a4032d4f (patch) | |
tree | c2b06dd5560ecd3907af5fa8e8e3dfadd65b0240 /web/template | |
parent | f028d5c1409c1083e742fceeb1651cce7fd54ec2 (diff) | |
download | aurweb-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/template')
-rw-r--r-- | web/template/pkg_comments.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index 20cd278..7c42ac1 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -1,8 +1,9 @@ <div class="pgbox"> <?php +$uid = uid_from_sid($SID); while (list($indx, $carr) = each($comments)) { ?> <div class="comment-header"><?php - if (canDeleteComment($carr['ID'], $atype, $SID)) { + if (canDeleteCommentArray($carr, $atype, $uid)) { $durl = '<a href="pkgedit.php?del_Comment=1'; $durl.= '&comment_id=' . $carr['ID'] . '&ID=' . $row['ID']; $durl.= '"><img src="images/x.png" border="0"'; |