mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
28 lines
793 B
PHP
28 lines
793 B
PHP
<div class="pgbox">
|
|
<?php
|
|
$uid = uid_from_sid($SID);
|
|
while (list($indx, $carr) = each($comments)) { ?>
|
|
<div class="comment-header"><?php
|
|
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"';
|
|
$durl.= ' alt="' . __("Delete comment") . '"></a> ';
|
|
|
|
echo $durl;
|
|
}
|
|
|
|
if ($SID) {
|
|
$carr['UserName'] = "<a href=\"account.php?Action=AccountInfo&ID={$carr['UsersID']}\">{$carr['UserName']}</a>";
|
|
}
|
|
|
|
echo __('Comment by: %s on %s', $carr['UserName'], gmdate('r', $carr['CommentTS']));
|
|
?></div>
|
|
<blockquote class="comment-body">
|
|
<div>
|
|
<?php echo nl2br(htmlspecialchars($carr['Comments'])) ?>
|
|
</div>
|
|
</blockquote>
|
|
<?php
|
|
} ?>
|
|
</div>
|