2011-03-06, 11:47 PM
I'm having a serious performance decrease with query cache and part of the issue is the is_moderator function which is widely used on MyBB pages like search, newreply, moderation, showthread, usercp, xmlhttp, and well..just about everywhere.
My current dillema seems to be that even though I use xcache and my $cache['moderators'] table is fine there are constant calls to mysql from the queries in get_moderator_permissions() function. But that function imho is not the real problem.
That function gets called from is_moderator and triggered in this code:
I notice that moderators cache does have FID. So why does there have to be a call to function get_moderator_permissions when a grab of the cache will suffice? All the perms required appear to be in the cache.
This line is practically worthless.
So if MyBB dev team can review this code for optimization and a performance increase I'd appreciate it.
My current dillema seems to be that even though I use xcache and my $cache['moderators'] table is fine there are constant calls to mysql from the queries in get_moderator_permissions() function. But that function imho is not the real problem.
That function gets called from is_moderator and triggered in this code:
if(!$fid)
{
$modcache = $cache->read('moderators');
if(!empty($modcache))
{
foreach($modcache as $modusers)
{
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])
{
return true;
}
elseif(isset($modusers['usergroups'][$user_perms['gid']]))
{
// Moderating usergroup
return true;
}
}
}
return false;
}
else
{
$modperms = get_moderator_permissions($fid, $uid);
I notice that moderators cache does have FID. So why does there have to be a call to function get_moderator_permissions when a grab of the cache will suffice? All the perms required appear to be in the cache.
This line is practically worthless.
$modperms = get_moderator_permissions($fid, $uid);
So if MyBB dev team can review this code for optimization and a performance increase I'd appreciate it.