I have a big forum with lots of user registrations and customised deletions. Anyway, I'm trying to optimise my SQL space as efficiently as possible so I've added the following command to a cron task:
Code: Select all
$sql_inner = "DELETE g.* FROM phpbb_user_group AS u RIGHT JOIN phpbb_groups AS g ON (g.group_id = u.group_id) WHERE u.user_id IS NULL AND g.group_id > 2";
$db->sql_query($sql_inner);
Basically it deletes any group from phpbb_groups that doesn't have a user ID attached to it, excluding the guest group and admin (shouldn't get deleted by this query anyway but I added the >2 just in case). I've been having issues with my test site after running this query (some functions in functions.php aren't being recognised). These errors started after I ran this query, but surely it can't be the cause of the problems!? Can it?