diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 95f3db9a65b32..3f322034c33f7 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -404,6 +404,9 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function () use ($node) { return $node->getFileInfo()->getCreationTime(); }); + $propFind->handle(self::CREATIONDATE_PROPERTYNAME, function () use ($node): int { + return $node->getFileInfo()->getCreationTime(); + }); } if ($node instanceof \OCA\DAV\Connector\Sabre\File) { diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 45e911db182a0..123f8b86fb654 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -118,6 +118,9 @@ public function getPropertyDefinitionsForScope($href, $path) { new SearchPropertyDefinition('{DAV:}displayname', true, true, true), new SearchPropertyDefinition('{DAV:}getcontenttype', true, true, true), new SearchPropertyDefinition('{DAV:}getlastmodified', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME), + new SearchPropertyDefinition('{DAV:}creationdate', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME), + new SearchPropertyDefinition(FilesPlugin::CREATION_TIME_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME), + new SearchPropertyDefinition(FilesPlugin::UPLOAD_TIME_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME), new SearchPropertyDefinition(FilesPlugin::SIZE_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER), new SearchPropertyDefinition(TagsPlugin::FAVORITE_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_BOOLEAN), new SearchPropertyDefinition(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, true, true, false, SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER), @@ -249,6 +252,11 @@ private function getSearchResultProperty(SearchResult $result, SearchPropertyDef return $node->getName(); case '{DAV:}getlastmodified': return $node->getLastModified(); + case '{DAV:}creationdate': + case FilesPlugin::CREATION_TIME_PROPERTYNAME: + return $node->getFileInfo()->getCreationTime(); + case FilesPlugin::UPLOAD_TIME_PROPERTYNAME: + return $node->getFileInfo()->getUploadTime(); case FilesPlugin::SIZE_PROPERTYNAME: return $node->getSize(); case FilesPlugin::INTERNAL_FILEID_PROPERTYNAME: @@ -351,6 +359,11 @@ private function mapPropertyNameToColumn(SearchPropertyDefinition $property) { return 'mimetype'; case '{DAV:}getlastmodified': return 'mtime'; + case '{DAV:}creationdate': + case FilesPlugin::CREATION_TIME_PROPERTYNAME: + return 'creation_time'; + case FilesPlugin::UPLOAD_TIME_PROPERTYNAME: + return 'upload_time'; case FilesPlugin::SIZE_PROPERTYNAME: return 'size'; case TagsPlugin::FAVORITE_PROPERTYNAME: diff --git a/lib/private/Files/Cache/SearchBuilder.php b/lib/private/Files/Cache/SearchBuilder.php index 003d3ac15e776..3449c18d3df92 100644 --- a/lib/private/Files/Cache/SearchBuilder.php +++ b/lib/private/Files/Cache/SearchBuilder.php @@ -178,6 +178,8 @@ private function validateComparison(ISearchComparison $operator) { $types = [ 'mimetype' => 'string', 'mtime' => 'integer', + 'creation_time' => 'integer', + 'upload_time' => 'integer', 'name' => 'string', 'path' => 'string', 'size' => 'integer', @@ -188,6 +190,8 @@ private function validateComparison(ISearchComparison $operator) { ]; $comparisons = [ 'mimetype' => ['eq', 'like'], + 'creation_time' => ['eq', 'gt', 'lt', 'gte', 'lte'], + 'upload_time' => ['eq', 'gt', 'lt', 'gte', 'lte'], 'mtime' => ['eq', 'gt', 'lt', 'gte', 'lte'], 'name' => ['eq', 'like', 'clike'], 'path' => ['eq', 'like', 'clike'],