Bug Fix: delete really all user's data when removing a user
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@221 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
db61722502
commit
6f95a6af53
4 changed files with 138 additions and 94 deletions
|
@ -24,6 +24,9 @@ $bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservi
|
|||
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
|
||||
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
|
||||
$tagcacheservice = & ServiceFactory :: getServiceInstance('TagCacheService');
|
||||
$commondescriptionservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
|
||||
$searchhistoryservice = & ServiceFactory :: getServiceInstance('SearchHistoryService');
|
||||
$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService');
|
||||
|
||||
// Header variables
|
||||
$tplVars['subtitle'] = T_('Manage users');
|
||||
|
@ -57,6 +60,9 @@ if ( $action
|
|||
$tag2tagservice->removeLinkedTags('','','',$uId);
|
||||
$userservice->deleteUser($uId);
|
||||
$bookmark2tagservice->deleteTagsForUser($uId);
|
||||
$commondescriptionservice->deleteDescriptionsForUser($uId);
|
||||
$searchhistoryservice->deleteSearchHistoryForUser($uId);
|
||||
$tagstatservice->deleteTagStatForUser($uId);
|
||||
// XXX: don't delete bookmarks before tags, else tags can't be deleted !!!
|
||||
$bookmarkservice->deleteBookmarksForUser($uId);
|
||||
|
||||
|
|
|
@ -140,6 +140,20 @@ class CommonDescriptionService {
|
|||
|
||||
}
|
||||
|
||||
function deleteDescriptionsForUser($uId){
|
||||
$query = 'DELETE FROM '. $this->getTableName() . ' WHERE uId = '. intval($uId);
|
||||
|
||||
$this->db->sql_transaction('begin');
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
$this->db->sql_transaction('rollback');
|
||||
message_die(GENERAL_ERROR, 'Could not delete user descriptions', '',
|
||||
__LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function deleteAll() {
|
||||
$query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';
|
||||
|
|
|
@ -99,6 +99,18 @@ class SearchHistoryService {
|
|||
}
|
||||
}
|
||||
|
||||
function deleteSearchHistoryForUser($uId) {
|
||||
$query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
|
||||
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete search history', '',
|
||||
__LINE__, __FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function deleteAll() {
|
||||
$query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';
|
||||
$this->db->sql_query($query);
|
||||
|
|
|
@ -169,6 +169,18 @@ class TagStatService {
|
|||
$this->db->sql_query($query);
|
||||
}
|
||||
|
||||
function deleteTagStatForUser($uId) {
|
||||
$query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
|
||||
|
||||
if (!($dbresult = & $this->db->sql_query($query))) {
|
||||
message_die(GENERAL_ERROR, 'Could not delete tag stats', '', __LINE__,
|
||||
__FILE__, $query, $this->db);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function deleteAll() {
|
||||
$query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';
|
||||
$this->db->sql_query($query);
|
||||
|
|
Loading…
Reference in a new issue