mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
f028d5c140
commit
55da4d4e0d
3 changed files with 19 additions and 6 deletions
|
@ -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"]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue