Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/16973] Use actual role ids for comparison of orphaned roles #6373

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions phpBB/phpbb/db/migration/data/v33x/remove_orphaned_roles.php
Expand Up @@ -30,13 +30,17 @@ public function update_data()
public function acl_remove_orphaned_roles()
{
$role_ids = [];
$auth_role_ids = [];

$sql = 'SELECT auth_role_id
FROM ' . ACL_GROUPS_TABLE . '
WHERE auth_role_id <> 0
AND forum_id = 0';
$result = $this->db->sql_query($sql);
$auth_role_ids = array_keys($this->db->sql_fetchrowset($result));
while ($row = $this->db->sql_fetchrow($result))
{
$auth_role_ids[] = $row['auth_role_id'];
}
$this->db->sql_freeresult($result);

if (count($auth_role_ids))
Expand All @@ -45,7 +49,10 @@ public function acl_remove_orphaned_roles()
FROM ' . ACL_ROLES_TABLE . '
WHERE ' . $this->db->sql_in_set('role_id', $auth_role_ids);
$result = $this->db->sql_query($sql);
$role_ids = array_keys($this->db->sql_fetchrowset($result));
while ($row = $this->db->sql_fetchrow($result))
{
$role_ids[] = $row['role_id'];
}
$this->db->sql_freeresult($result);
}

Expand Down