mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 20:38:52 +00:00
Merge pull request #6373 from marc1706/ticket/16973
[ticket/16973] Use actual role ids for comparison of orphaned roles
This commit is contained in:
commit
34f27a1670
1 changed files with 9 additions and 2 deletions
|
@ -30,13 +30,17 @@ class remove_orphaned_roles extends \phpbb\db\migration\migration
|
||||||
public function acl_remove_orphaned_roles()
|
public function acl_remove_orphaned_roles()
|
||||||
{
|
{
|
||||||
$role_ids = [];
|
$role_ids = [];
|
||||||
|
$auth_role_ids = [];
|
||||||
|
|
||||||
$sql = 'SELECT auth_role_id
|
$sql = 'SELECT auth_role_id
|
||||||
FROM ' . ACL_GROUPS_TABLE . '
|
FROM ' . ACL_GROUPS_TABLE . '
|
||||||
WHERE auth_role_id <> 0
|
WHERE auth_role_id <> 0
|
||||||
AND forum_id = 0';
|
AND forum_id = 0';
|
||||||
$result = $this->db->sql_query($sql);
|
$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);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
if (count($auth_role_ids))
|
if (count($auth_role_ids))
|
||||||
|
@ -45,7 +49,10 @@ class remove_orphaned_roles extends \phpbb\db\migration\migration
|
||||||
FROM ' . ACL_ROLES_TABLE . '
|
FROM ' . ACL_ROLES_TABLE . '
|
||||||
WHERE ' . $this->db->sql_in_set('role_id', $auth_role_ids);
|
WHERE ' . $this->db->sql_in_set('role_id', $auth_role_ids);
|
||||||
$result = $this->db->sql_query($sql);
|
$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);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue