Support fileid propfind on trash endpoint

Fixes #9416

In order to support previews on mobile clients they will need the fileid
of files in the trashbin.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-05-10 16:03:28 +02:00
parent 8d17d7f6cd
commit 5eb72a8a57
No known key found for this signature in database
GPG key ID: F941078878347C0C
7 changed files with 26 additions and 2 deletions

View file

@ -62,7 +62,6 @@ class Helper {
$dirContent = $storage->getCache()->getFolderContents($mount->getInternalPath($view->getAbsolutePath($dir)));
foreach ($dirContent as $entry) {
$entryName = $entry->getName();
$id = $entry->getId();
$name = $entryName;
if ($dir === '' || $dir === '/') {
$pathparts = pathinfo($entryName);
@ -91,7 +90,8 @@ class Helper {
'directory' => ($dir === '/') ? '' : $dir,
'size' => $entry->getSize(),
'etag' => '',
'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE
'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE,
'fileid' => $entry->getId(),
);
if ($originalPath) {
if ($originalPath !== '.') {

View file

@ -33,4 +33,6 @@ interface ITrash {
public function getDeletionTime(): int;
public function getSize();
public function getFileId(): int;
}

View file

@ -69,6 +69,10 @@ class PropfindPlugin extends ServerPlugin {
$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
return $node->getSize();
});
$propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
return $node->getFileId();
});
}
}

View file

@ -90,4 +90,10 @@ class TrashFile implements IFile, ITrash {
public function getDeletionTime(): int {
return $this->getLastModified();
}
public function getFileId(): int {
return $this->data->getId();
}
}

View file

@ -123,4 +123,8 @@ class TrashFolder implements ICollection, ITrash {
public function getSize(): int {
return $this->data->getSize();
}
public function getFileId(): int {
return $this->data->getId();
}
}

View file

@ -101,4 +101,8 @@ class TrashFolderFile implements IFile, ITrash {
public function getDeletionTime(): int {
return $this->getLastModified();
}
public function getFileId(): int {
return $this->data->getId();
}
}

View file

@ -136,4 +136,8 @@ class TrashFolderFolder implements ICollection, ITrash {
public function getSize(): int {
return $this->data->getSize();
}
public function getFileId(): int {
return $this->data->getId();
}
}