Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.16.14

Bug #2214 LiveUser_Admin_Perm_Container_DB_Simple::removeUser() violates constraints
Submitted: 2004-08-25 13:31 UTC
From: mflaherty at clearmessage dot com Assigned: dufuz
Status: Closed Package: LiveUser
PHP Version: 4.3.3 OS:
Roadmaps: (Not assigned)    
Subscription  


 [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; }

Comments

 [2004-08-27 14:07 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [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.