diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-05-26 15:53:07 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-05-26 15:53:07 +0000 |
commit | 12fdaddf6ae1d9c1ece8afffea6017709c742f18 (patch) | |
tree | 4669a8e2f71e72d5be87cca13aa0d437b51122a2 | |
parent | ab7d79e4c0a9f5a6bb2b1cc2a4608b47670724ef (diff) | |
download | semanticscuttle-12fdaddf6ae1d9c1ece8afffea6017709c742f18.tar.gz semanticscuttle-12fdaddf6ae1d9c1ece8afffea6017709c742f18.tar.bz2 |
Bug fix: allow deleting links between tags when deleting a user.
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@339 b3834d28-1941-0410-a4f8-b48e95affb8f
-rw-r--r-- | admin.php | 2 | ||||
-rw-r--r-- | services/tag2tagservice.php | 17 |
2 files changed, 18 insertions, 1 deletions
@@ -56,7 +56,7 @@ if ( $action $uId = $userinfo['uId'];
$tagcacheservice->deleteByUser($uId); - $tag2tagservice->removeLinkedTags('','','',$uId);
+ $tag2tagservice->removeLinkedTagsForUser($uId);
$userservice->deleteUser($uId);
$bookmark2tagservice->deleteTagsForUser($uId); $commondescriptionservice->deleteDescriptionsForUser($uId); diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php index b2ffbf0..956fd49 100644 --- a/services/tag2tagservice.php +++ b/services/tag2tagservice.php @@ -309,6 +309,23 @@ class Tag2TagService { $this->db->sql_freeresult($dbresult); return true; } + + function removeLinkedTagsForUser($uId) { + $query = 'DELETE FROM '. $this->getTableName(); + $query.= ' WHERE uId = "'. $uId .'"'; + + if (!($dbresult =& $this->db->sql_query($query))) { + message_die(GENERAL_ERROR, 'Could not remove tag relation', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + + + // Update stats and cache + $this->update('', '', '', $uId); + + $this->db->sql_freeresult($dbresult); + return true; + } function renameTag($uId, $oldName, $newName) { $tagservice =& ServiceFactory::getServiceInstance('TagService'); |