Skip to content

Commit 2a2d89c

Browse files
committed
fixup! feat(IUserFolder): add a user folder class
Signed-off-by: Côme Chilliet <[email protected]>
1 parent 3670078 commit 2a2d89c

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

lib/private/Files/Node/Root.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use OCP\Files\Config\IUserMountCache;
2323
use OCP\Files\Events\Node\FilesystemTornDownEvent;
2424
use OCP\Files\IRootFolder;
25+
use OCP\Files\IUserFolder;
2526
use OCP\Files\Mount\IMountPoint;
2627
use OCP\Files\Node as INode;
2728
use OCP\Files\NotFoundException;
@@ -319,12 +320,10 @@ public function getName() {
319320
/**
320321
* Returns a view to user's files folder
321322
*
322-
* @param string $userId user ID
323-
* @return \OCP\Files\IUserFolder
324323
* @throws NoUserException
325324
* @throws NotPermittedException
326325
*/
327-
public function getUserFolder($userId) {
326+
public function getUserFolder(string $userId): IUserFolder {
328327
$userObject = $this->userManager->get($userId);
329328

330329
if (is_null($userObject)) {

lib/public/Files/IRootFolder.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/**
46
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
57
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
68
* SPDX-License-Identifier: AGPL-3.0-only
79
*/
10+
811
namespace OCP\Files;
912

1013
use OC\Hooks\Emitter;
1114
use OC\User\NoUserException;
15+
use OCP\AppFramework\Attribute\Consumable;
1216
use OCP\Files\Cache\ICacheEntry;
1317
use OCP\Files\Mount\IMountPoint;
1418
use OCP\Files\Node as INode;
@@ -18,6 +22,7 @@
1822
*
1923
* @since 8.0.0
2024
*/
25+
#[Consumable(since: '8.0.0')]
2126
interface IRootFolder extends Folder, Emitter {
2227
/**
2328
* Returns a view to user's files folder
@@ -28,9 +33,9 @@ interface IRootFolder extends Folder, Emitter {
2833
* @throws NotPermittedException
2934
*
3035
* @since 8.2.0
31-
* @since 32.0.0 returns OCP\Files\IUserFolder instead of OCP\Files\Folder
36+
* @since 33.0.0 returns OCP\Files\IUserFolder instead of OCP\Files\Folder
3237
*/
33-
public function getUserFolder($userId);
38+
public function getUserFolder(string $userId): IUserFolder;
3439

3540
/**
3641
* Get a file or folder by fileid, inside a parent path

lib/public/Files/IUserFolder.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
<?php
22

33
declare(strict_types=1);
4+
45
/**
56
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
67
* SPDX-License-Identifier: AGPL-3.0-or-later
78
*/
9+
810
namespace OCP\Files;
911

12+
use OCP\AppFramework\Attribute\Consumable;
13+
1014
/**
11-
* @since 32.0.0
15+
* @since 33.0.0
1216
*/
17+
#[Consumable(since: '33.0.0')]
1318
interface IUserFolder extends Folder {
1419

1520
/**
1621
* @param bool $useCache - Use the cached value if available instead of recalculate.
1722
* @return array{used: int|float, free: int|float, total: int|float, quota: int|float}
18-
* @since 32.0.0
23+
* @since 33.0.0
1924
*/
2025
public function getUserQuota(bool $useCache = true): array;
2126

0 commit comments

Comments
 (0)