|
19 | 19 | use OCA\DAV\CalDAV\Trashbin\TrashbinHome; |
20 | 20 | use OCA\DAV\Connector\Sabre\Directory; |
21 | 21 | use OCA\DAV\Db\PropertyMapper; |
| 22 | +use OCA\DAV\Connector\Sabre\FilesPlugin; |
| 23 | +use OCA\Files_Trashbin\Sabre\TrashRoot; |
22 | 24 | use OCP\DB\QueryBuilder\IQueryBuilder; |
| 25 | +use OCP\Files\Folder; |
23 | 26 | use OCP\IDBConnection; |
24 | 27 | use OCP\IUser; |
25 | 28 | use Sabre\CalDAV\Schedule\Inbox; |
@@ -207,8 +210,13 @@ public function propFind($path, PropFind $propFind) { |
207 | 210 | } |
208 | 211 |
|
209 | 212 | $node = $this->tree->getNodeForPath($path); |
210 | | - if ($node instanceof Directory && $propFind->getDepth() !== 0) { |
211 | | - $this->cacheDirectory($path, $node); |
| 213 | + if (($node instanceof Directory) && $propFind->getDepth() !== 0) { |
| 214 | + $this->cacheDirectory($path, $node->getNode()); |
| 215 | + } else if ($node instanceof TrashRoot) { |
| 216 | + $trashNodes = $node->getTrashRoots(); |
| 217 | + foreach ($trashNodes as $trashNode) { |
| 218 | + $this->cacheDirectory($path, $trashNode); |
| 219 | + } |
212 | 220 | } |
213 | 221 |
|
214 | 222 | if ($node instanceof CalendarHome && $propFind->getDepth() !== 0) { |
@@ -358,18 +366,17 @@ private function getPublishedProperties(string $path, array $requestedProperties |
358 | 366 | /** |
359 | 367 | * prefetch all user properties in a directory |
360 | 368 | */ |
361 | | - private function cacheDirectory(string $path, Directory $node): void { |
| 369 | + private function cacheDirectory(string $path, Folder $node): void { |
362 | 370 | $prefix = ltrim($path . '/', '/'); |
363 | 371 | $query = $this->connection->getQueryBuilder(); |
364 | 372 | $query->select('name', 'p.propertypath', 'p.propertyname', 'p.propertyvalue', 'p.valuetype') |
365 | 373 | ->from('filecache', 'f') |
366 | | - ->hintShardKey('storage', $node->getNode()->getMountPoint()->getNumericStorageId()) |
| 374 | + ->hintShardKey('storage', $node->getMountPoint()->getNumericStorageId()) |
367 | 375 | ->leftJoin('f', 'properties', 'p', $query->expr()->eq('p.propertypath', $query->func()->concat( |
368 | 376 | $query->createNamedParameter($prefix), |
369 | 377 | 'f.name' |
370 | | - )), |
371 | | - ) |
372 | | - ->where($query->expr()->eq('parent', $query->createNamedParameter($node->getInternalFileId(), IQueryBuilder::PARAM_INT))) |
| 378 | + ))) |
| 379 | + ->where($query->expr()->eq('parent', $query->createNamedParameter($node->getId(), IQueryBuilder::PARAM_INT))) |
373 | 380 | ->andWhere($query->expr()->orX( |
374 | 381 | $query->expr()->eq('p.userid', $query->createNamedParameter($this->user->getUID())), |
375 | 382 | $query->expr()->isNull('p.userid'), |
|
0 commit comments