Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
vud_widget_proxy() issues a number of database queries whether or not the widget used is actually going to use the result or not.
I added a permissions check to confirm whether the user viewing the widget is allowed to vote or not before trying to look up their vote, this saves 90 queries when viewing 90 comments showing the widget.
It looks like some of the other queries could be consolidated or run selectively but can't see a simple way to do this generically.
Comment | File | Size | Author |
---|---|---|---|
#4 | 0001-bug-962996-by-catch-marvil07-Avoid-unnecessary-queri-v2.patch | 4 KB | marvil07 |
#3 | 0001-bug-962996-by-catch-marvil07-Avoid-unnecessary-queri.patch | 3.15 KB | marvil07 |
user_votes.patch | 488 bytes | catch | |
Comments
Comment #1
marvil07 CreditAttribution: marvil07 commentedThanks for the patch :-)
Right, we need to use that patch, but, since I also added positives/negatives, I think we can also avoid that queries(2 less queries per widget show ;-)) after #968630: Let widgets modify template variables gets in.. so I hopefully will be providing a patch for this after the other issue is fixed.
Comment #2
marvil07 CreditAttribution: marvil07 commentedComment #3
marvil07 CreditAttribution: marvil07 commentedminor typo in the permission name fixed.
As mentioned, this patch only query positives and negatives for upanddown widget, since it is the only place where it is used.
@catch: it would be great if you can take a look at this before committing it, just in case you want to add something.
Powered by Dreditor.
Comment #4
marvil07 CreditAttribution: marvil07 commenteda little addition: fix documentation.
Comment #5
marvil07 CreditAttribution: marvil07 commentedOk, committed to 3.x.
Comment #6
catchSorry I was away over the weekend, will try to get this reviewed and tested a bit more tomorrow post-commit.