aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Hooks.php
blob: 1e2a8d4109837a1c7733ce9c546bf96700dc3f0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
 * SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
 * SPDX-License-Identifier: AGPL-3.0-only
 */
namespace OCA\Files_Trashbin;

class Hooks {

	/**
	 * clean up user specific settings if user gets deleted
	 * @param array $params array with uid
	 *
	 * This function is connected to the pre_deleteUser signal of OC_Users
	 * to remove the used space for the trash bin stored in the database
	 */
	public static function deleteUser_hook($params) {
		$uid = $params['uid'];
		Trashbin::deleteUser($uid);
	}

	public static function post_write_hook($params) {
		$user = \OC_User::getUser();
		if (!empty($user)) {
			Trashbin::resizeTrash($user);
		}
	}
}