1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Let contactDeletion() hook take multiple ids.

This commit is contained in:
Thomas Tanghus 2013-05-27 06:55:21 +02:00
parent d20ff966fe
commit aea9e3f48a

View File

@ -83,18 +83,18 @@ class Hooks{
* A contact has been deleted and cleanup for property indexes and
* group/contact relations must be performed.
*
* NOTE: When deleting an entire address book the cleanup is done directly
* in the backend for effeciency. If any other cleanup procedures are added
* to this hook, the equivalent must also be done in the backend(s) (Database).
* (Or better, implement addressBookDeletion)
* NOTE: When deleting an entire address book the cleanup is done in the
* addressBookDeletion() hook. Any cleanup procedures most be implemented
* in both.
*
* @param array $parameters Currently only the id of the contact.
*/
public static function contactDeletion($parameters) {
//\OCP\Util::writeLog('contacts', __METHOD__.' parameters: '.print_r($parameters, true), \OCP\Util::DEBUG);
$ids = is_array($parameters['id']) ? $parameters['id'] : array($parameters['id']);
$catctrl = new \OC_VCategories('contact');
$catctrl->purgeObjects(array($parameters['id']));
Utils\Properties::updateIndex($parameters['id']);
$catctrl->purgeObjects($ids);
Utils\Properties::purgeIndexes($ids);
// Contact sharing not implemented, but keep for future.
//\OCP\Share::unshareAll('contact', $id);