Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/Storage/DirMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ class DirMask extends PermissionsMask {
private readonly int $pathLength;

/**
* Compatibility layer for Nextcloud 31-33 versions where the
* {@see PermissionsMask::$mask} was private on PermissionsMask.
* Once Nextcloud 34 is the minimum this variable can be dropped completely
* and {@see PermissionsMask::$mask} can be used again.
*
* @var int the permissions bits we want to keep
*/
private $mask;
protected readonly int $maskWorkaround;

/**
* @param array{storage: \OCP\Files\Storage\IStorage, mask: int, path: string, ...} $parameters
Expand All @@ -48,7 +53,7 @@ public function __construct($parameters) {
parent::__construct($parameters);
$this->path = rtrim((string)$parameters['path'], '/');
$this->pathLength = strlen((string)$parameters['path']);
$this->mask = $parameters['mask'];
$this->maskWorkaround = $parameters['mask'];
}

protected function checkPath(string $path): bool {
Expand Down Expand Up @@ -196,6 +201,8 @@ public function getCache($path = '', $storage = null): ICache {
}

$sourceCache = $this->storage->getCache($path, $storage);
return new DirMaskCache($sourceCache, $this->mask, $this->checkPath(...));
// Todo replace when Nextcloud 34 is the minimum version
// return new DirMaskCache($sourceCache, $this->mask, $this->checkPath(...));
return new DirMaskCache($sourceCache, $this->maskWorkaround, $this->checkPath(...));
}
}
2 changes: 1 addition & 1 deletion tests/stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ public function getQuota() {
}

class PermissionsMask extends Wrapper {
public int $mask;
protected readonly int $mask;
public \OCP\Files\Storage\IStorage $storage;

public function __construct($parameters) {
Expand Down
Loading