Use getType to determine type of entry

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-04-25 11:59:48 +02:00
parent d5937e0fd6
commit dadc740db5
No known key found for this signature in database
GPG key ID: F941078878347C0C
3 changed files with 6 additions and 6 deletions

View file

@ -51,7 +51,7 @@ class TrashFolder implements ICollection, ITrash {
foreach ($entries as $entry) {
if ($entry->getName() === $name) {
if ($entry->getMimetype() === 'httpd/unix-directory') {
if ($entry->getType() === FileInfo::TYPE_FOLDER) {
return new TrashFolderFolder($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
}
return new TrashFolderFile($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
@ -63,7 +63,7 @@ class TrashFolder implements ICollection, ITrash {
$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
$children = array_map(function (FileInfo $entry) {
if ($entry->getMimetype() === 'httpd/unix-directory') {
if ($entry->getType() === FileInfo::TYPE_FOLDER) {
return new TrashFolderFolder($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
}
return new TrashFolderFile($this->getName(), $this->userId, $entry, $this->getOriginalLocation());

View file

@ -64,7 +64,7 @@ class TrashFolderFolder implements ICollection, ITrash {
foreach ($entries as $entry) {
if ($entry->getName() === $name) {
if ($entry->getMimetype() === 'httpd/unix-directory') {
if ($entry->getType() === FileInfo::TYPE_FOLDER) {
return new TrashFolderFolder($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
}
return new TrashFolderFile($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
@ -76,7 +76,7 @@ class TrashFolderFolder implements ICollection, ITrash {
$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
$children = array_map(function (FileInfo $entry) {
if ($entry->getMimetype() === 'httpd/unix-directory') {
if ($entry->getType() === FileInfo::TYPE_FOLDER) {
return new TrashFolderFolder($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
}
return new TrashFolderFile($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());

View file

@ -75,7 +75,7 @@ class TrashHome implements ICollection {
foreach ($entries as $entry) {
if ($entry->getName() . '.d'.$entry->getMtime() === $name) {
if ($entry->getMimetype() === 'httpd/unix-directory') {
if ($entry->getType() === FileInfo::TYPE_FOLDER) {
return new TrashFolder('/', $userId, $entry);
}
return new TrashFile($userId, $entry);
@ -91,7 +91,7 @@ class TrashHome implements ICollection {
$entries = \OCA\Files_Trashbin\Helper::getTrashFiles('/', $userId);
$children = array_map(function (FileInfo $entry) use ($userId) {
if ($entry->getMimetype() === 'httpd/unix-directory') {
if ($entry->getType() === FileInfo::TYPE_FOLDER) {
return new TrashFolder('/', $userId, $entry);
}
return new TrashFile($userId, $entry);