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