Added \RainLoop\Api::ClearUserData() function

This commit is contained in:
RainLoop Team 2014-08-14 00:40:56 +04:00
parent 290cf38b97
commit 9a30680748
11 changed files with 363 additions and 279 deletions

View file

@ -671,6 +671,30 @@ class PdoAddressBook
return true;
}
/**
* @param string $sEmail
* @param bool $bSyncDb = true
*
* @return bool
*/
public function DeleteAllContactsAndTags($sEmail, $bSyncDb = true)
{
if ($bSyncDb)
{
$this->SyncDatabase();
}
$iUserID = $this->getUserId($sEmail);
$aParams = array(':id_user' => array($iUserID, \PDO::PARAM_INT));
$this->prepareAndExecute('DELETE FROM rainloop_ab_properties WHERE id_user = :id_user', $aParams);
$this->prepareAndExecute('DELETE FROM rainloop_ab_contacts WHERE id_user = :id_user', $aParams);
$this->prepareAndExecute('DELETE FROM rainloop_ab_tags WHERE id_user = :id_user', $aParams);
return true;
}
/**
* @param string $sEmail
* @param array $aTagsIds