The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
In global.php
$show['modcplink'] is being set (for the ModCP-Link in template footer). This seems to trigger a query in can_moderate() if the user is not an admin or supermod - for every page being generated. I wonder if it wouldn't be possible to use some cache (datastore) instead to avoid this query and if this could improve performance? |
#2
|
||||
|
||||
![]()
the first if does just use the permission cache, so no query is done until:
PHP Code:
|
#3
|
||||
|
||||
![]()
> just if the cache has not been created, it will do a query.
That's the point. $imodcache is being build in cache_moderators() which itself gets called from forumdisplay.php, index.php, search.php & usercp.php - after processing global.php. And what about the others like showthread.php, newreply.php and so on? |
#4
|
||||
|
||||
![]()
Seeing as cache_moderators() requires a query and so does can_moderate() using can_moderate() would be prefered as its doing less work. It does seem that in my RC3 copy that they have 'forgotten/not included yet' the caching in the can_moderate() function, the $modcache variable is there, yet its never set, which causes extra queries every time can_moderate() is called where it could quite possibly return a cached value instead.
|
#5
|
||||
|
||||
![]()
*bump*
Now that RC4 is available it seems like this doesn't have changed ![]() Example ----------- If a thread is being displayed (by a normal user, 40 posts/page) and can_moderate() is being called from the postbit I get 42 (!) times the same query: Code:
SELECT moderatorid, permissions FROM moderator WHERE userid = 3 ![]() |
#6
|
||||
|
||||
![]()
ugh you querry freaks :P
|
#7
|
||||
|
||||
![]()
So you have 42+ queries on that page? Thats not good. I'm sure some caching is ment to be used in the function, create a bug report at vB.com.
|
#8
|
||||
|
||||
![]() Quote:
|
#9
|
||||
|
||||
![]()
@Faranth
It's very easy to reproduce: 1) Take a vanilla vB3 RCwhatever 2) Enable debug mode (to see # of queries) 3) Put an <if condition="can_moderate()"></if> at the start of template postbit 4) Display a thread with > 40 posts as a normal user (setting display-mode to 40 posts/page) |
#10
|
||||
|
||||
![]()
you should definitely report it.
vb.com will surely look into it ![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|