aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-02-15 19:10:02 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-02-15 19:10:02 +0000
commit9e55e1738874a0ab352f91a15012b33fe1c3e9f9 (patch)
tree09ca4ced265a499b0fcb64a4560e1c9a7afba20d /phpBB/includes/functions_admin.php
parent143b5a76ad1ebd67bbe54832579c8f5e6f2f3716 (diff)
downloadforums-9e55e1738874a0ab352f91a15012b33fe1c3e9f9.tar
forums-9e55e1738874a0ab352f91a15012b33fe1c3e9f9.tar.gz
forums-9e55e1738874a0ab352f91a15012b33fe1c3e9f9.tar.bz2
forums-9e55e1738874a0ab352f91a15012b33fe1c3e9f9.tar.xz
forums-9e55e1738874a0ab352f91a15012b33fe1c3e9f9.zip
revamp how we query permissions. This is half-experimental actually, needs a bit of testing.
Should fix the bug with low max_join_size values, but may give problems for those on very low memory settings. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8384 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 268eccbca4..7fd21948d0 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2998,6 +2998,29 @@ function tidy_database()
{
global $db;
+ // Here we check permission consistency
+
+ // Sometimes, it can happen permission tables having forums listed which do not exist
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE;
+ $result = $db->sql_query($sql);
+
+ $forum_ids = array(0);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $forum_ids[] = $row['forum_id'];
+ }
+ $db->sql_freeresult($result);
+
+ // Delete those rows from the acl tables not having listed the forums above
+ $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
+ WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true);
+ $db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
+ WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true);
+ $db->sql_query($sql);
+
set_config('database_last_gc', time(), true);
}