Skip to content
Open
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
5 changes: 5 additions & 0 deletions apps/files_trashbin/lib/Trash/TrashItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public function getStorage() {
return $this->fileInfo->getStorage();
}

#[\Override]
public function getStorageId(): int {
return $this->fileInfo->getStorageId();
}

#[\Override]
public function getId() {
return $this->fileInfo->getId();
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Files/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ public function getMimePart() {
return $this->data['mimepart'];
}

#[\Override]
public function getStorageId(): int {
return $this->getMountPoint()->getNumericStorageId();
}

/**
* @return string
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Files/Mount/MountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ public function getStorage() {
}

/**
* @return string|null
* @return string
*/
#[\Override]
public function getStorageId() {
if (!$this->storageId) {
$storage = $this->getStorage();
if (is_null($storage)) {
return null;
return 'invalid';
}
$this->storageId = $storage->getId();
if (strlen($this->storageId) > 64) {
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Files/Node/LazyFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ public function getStorage() {
return $this->__call(__FUNCTION__, func_get_args());
}

#[\Override]
public function getStorageId(): int {
return $this->__call(__FUNCTION__, func_get_args());
}

/**
* @inheritDoc
*/
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Files/Node/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public function getStorage() {
return $storage;
}

#[\Override]
public function getStorageId(): int {
return $this->getMountPoint()->getNumericStorageId();
}

/**
* @return string
*/
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Files/Node/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ public function getStorage() {
throw new NotFoundException();
}

#[\Override]
public function getStorageId(): int {
throw new NotFoundException();
}

/**
* @return string
*/
Expand Down
9 changes: 9 additions & 0 deletions lib/public/Files/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ public function getMimePart();
*/
public function getStorage();

/**
* Get the numeric storage id for the storage backend the file or folder is stored on
*
* @return int
* @throws NotFoundException
* @since 36.0.0
*/
public function getStorageId(): int;

/**
* Get the file id of the file or folder
*
Expand Down
4 changes: 2 additions & 2 deletions lib/public/Files/Mount/IMountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public function getStorage();
/**
* Get the id of the storages
*
* @return string|null
* @return string
* @since 8.0.0
*/
public function getStorageId();

/**
* Get the id of the storages
*
* @return int|null
* @return int
* @since 9.1.0
*/
public function getNumericStorageId();
Expand Down
10 changes: 10 additions & 0 deletions lib/public/Files/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ public function touch($mtime = null);
#[\Override]
public function getStorage();

/**
* Get the numeric storage id for the storage backend the file or folder is stored on
*
* @return int
* @throws NotFoundException
* @since 36.0.0
*/
#[\Override]
public function getStorageId(): int;

/**
* Get the full path of the file or folder
*
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Files/Mount/MountPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testInvalidStorage(): void {
// call it again to make sure the init code only ran once
$this->assertNull($mountPoint->getStorage());

$this->assertNull($mountPoint->getStorageId());
$this->assertEquals('invalid', $mountPoint->getStorageId());

// wrapping doesn't fail
$mountPoint->wrapStorage($wrapper);
Expand Down
Loading