Home » Authentication » LiveUser » Bug #2214
LiveUser_Admin_Perm_Container_DB_Simple::removeUser() violates constraints
Details
| Submitted | 2004-08-25 13:31 UTC |
|---|---|
| From | mflaherty at clearmessage dot com |
| Assigned | dufuz |
| Status | Closed |
| Package | LiveUser |
| PHP Version | 4.3.3 |
| Roadmaps | (Not assigned) |
Comments
[2004-08-25 13:31 UTC] mflaherty at clearmessage dot com
Description:
------------
LiveUser_Admin_Perm_Container_DB_Simple::removeUser() attempts to delete the parent liveuser_perm_users record before deleting its dependents. Naturally where constraints exists this will fail. Apply this patch to LiveUser/Admin/Perm/Container/DB_Simple.php
Reproduce code:
---------------
*** DB_Simple.php.orig Wed Aug 25 14:25:15 2004
--- DB_Simple.php Wed Aug 25 14:26:10 2004
***************
*** 1086,1104 ****
return false;
}
- // Delete user from perm table (Perm/DB)
- $query = '
- DELETE FROM
- ' . $this->prefix . 'perm_users
- WHERE
- perm_user_id = ' . $permId;
-
- $result = $this->dbc->query($query);
-
- if (DB::isError($result)) {
- return $result;
- }
-
// Delete group assignments
$query = 'DELETE FROM
' . $this->prefix . 'groupusers
--- 1086,1091 ----
***************
*** 1130,1135 ****
--- 1117,1135 ----
return $result;
};
+ // Delete user from perm table (Perm/DB)
+ $query = '
+ DELETE FROM
+ ' . $this->prefix . 'perm_users
+ WHERE
+ perm_user_id = ' . $permId;
+
+ $result = $this->dbc->query($query);
+
+ if (DB::isError($result)) {
+ return $result;
+ }
+
return true;
}
[2004-08-27 14:57 UTC] mflaherty at clearmessage dot com
Yeah, I know that out of the box this wouldn't be a problem because there are no foreign key constraints in the schema (which creates MyISAM tables anyhow), but I don't like to have databases that ignore referential integrity so I've preferred to create the foreign keys. As such it is helpful for the deletes to be in the correct order. Thank you.