I think i find a bug in query in updateBanMembers function, we have a more than 140 000 members in smf_members table and executing a new ban function is very slow, this query take near 60 second to execute:
SELECT mem.ID_MEMBER, mem.is_activated + 10 AS new_value
FROM ({$db_prefix}ban_groups AS bg, {$db_prefix}ban_items AS bi, {$db_prefix}members AS mem)
WHERE bg.ID_BAN_GROUP = bi.ID_BAN_GROUP
AND bg.cannot_access = 1
AND (bg.expire_time IS NULL OR bg.expire_time > " . time() . ")
AND (mem.ID_MEMBER = bi.ID_MEMBER OR mem.emailAddress LIKE bi.email_address)
AND mem.is_activated < 10
I rewrote query with much faster syntax
SELECT mem.ID_MEMBER, mem.is_activated +10 AS new_value
FROM {$db_prefix}ban_groups AS bg
LEFT JOIN {$db_prefix}ban_items AS bi ON bg.ID_BAN_GROUP = bi.ID_BAN_GROUP
LEFT JOIN {$db_prefix}members AS mem ON mem.ID_MEMBER = bi.ID_MEMBER
WHERE bg.cannot_access = 1
AND mem.is_activated < 10
AND (
bg.expire_time IS NULL
OR bg.expire_time >" . time() . "
)
AND (
mem.ID_MEMBER = bi.ID_MEMBER
OR mem.emailAddress LIKE bi.email_address
)
Can you look at my code and tell me if i done something wrong.
Thanks for all help!