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
This commit is contained in:
mensonge 2009-05-26 15:53:07 +00:00
parent ab7d79e4c0
commit 12fdaddf6a
2 changed files with 18 additions and 1 deletions

View file

@ -56,7 +56,7 @@ if ( $action
$uId = $userinfo['uId']; $uId = $userinfo['uId'];
$tagcacheservice->deleteByUser($uId); $tagcacheservice->deleteByUser($uId);
$tag2tagservice->removeLinkedTags('','','',$uId); $tag2tagservice->removeLinkedTagsForUser($uId);
$userservice->deleteUser($uId); $userservice->deleteUser($uId);
$bookmark2tagservice->deleteTagsForUser($uId); $bookmark2tagservice->deleteTagsForUser($uId);
$commondescriptionservice->deleteDescriptionsForUser($uId); $commondescriptionservice->deleteDescriptionsForUser($uId);

View file

@ -309,6 +309,23 @@ class Tag2TagService {
$this->db->sql_freeresult($dbresult); $this->db->sql_freeresult($dbresult);
return true; 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) { function renameTag($uId, $oldName, $newName) {
$tagservice =& ServiceFactory::getServiceInstance('TagService'); $tagservice =& ServiceFactory::getServiceInstance('TagService');