Hooks.php 738 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files_Trashbin;
  8. class Hooks {
  9. /**
  10. * clean up user specific settings if user gets deleted
  11. * @param array $params array with uid
  12. *
  13. * This function is connected to the pre_deleteUser signal of OC_Users
  14. * to remove the used space for the trash bin stored in the database
  15. */
  16. public static function deleteUser_hook($params) {
  17. $uid = $params['uid'];
  18. Trashbin::deleteUser($uid);
  19. }
  20. public static function post_write_hook($params) {
  21. $user = \OC_User::getUser();
  22. if (!empty($user)) {
  23. Trashbin::resizeTrash($user);
  24. }
  25. }
  26. }