diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-04-10 15:57:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-10 15:57:56 +0200 |
commit | e9c6fe2fd868d7254603a6fb23451392f2af8b54 (patch) | |
tree | b755e2afd08097e0f0e631de1a8604f482f93bb9 /apps/dav | |
parent | afea05d296831603b90a4087cde1724142e4ef26 (diff) | |
parent | bb7e236e7466dadcd909ec93cd894a7602473f88 (diff) | |
download | nextcloud-server-e9c6fe2fd868d7254603a6fb23451392f2af8b54.tar.gz nextcloud-server-e9c6fe2fd868d7254603a6fb23451392f2af8b54.zip |
Merge pull request #4222 from nextcloud/dav-search-fileid
Allow searching file by fileid
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Files/FileSearchBackend.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 5816c659932..0d837807fd8 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -116,6 +116,7 @@ class FileSearchBackend implements ISearchBackend { new SearchPropertyDefinition('{DAV:}getlastmodified', 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), // select only properties new SearchPropertyDefinition('{DAV:}resourcetype', false, true, false), @@ -127,7 +128,6 @@ class FileSearchBackend implements ISearchBackend { new SearchPropertyDefinition(FilesPlugin::OWNER_DISPLAY_NAME_PROPERTYNAME, false, true, false), new SearchPropertyDefinition(FilesPlugin::DATA_FINGERPRINT_PROPERTYNAME, false, true, false), new SearchPropertyDefinition(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, false, true, false, SearchPropertyDefinition::DATATYPE_BOOLEAN), - new SearchPropertyDefinition(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, false, true, false, SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER), new SearchPropertyDefinition(FilesPlugin::FILEID_PROPERTYNAME, false, true, false, SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER), ]; } @@ -222,7 +222,7 @@ class FileSearchBackend implements ISearchBackend { case Operator::OPERATION_IS_COLLECTION: return new SearchComparison('eq', 'mimetype', ICacheEntry::DIRECTORY_MIMETYPE); default: - throw new \InvalidArgumentException('Unsupported operation ' . $trimmedType. ' (' . $operator->type . ')'); + throw new \InvalidArgumentException('Unsupported operation ' . $trimmedType . ' (' . $operator->type . ')'); } } @@ -244,6 +244,8 @@ class FileSearchBackend implements ISearchBackend { return 'favorite'; case TagsPlugin::TAGS_PROPERTYNAME: return 'tagname'; + case FilesPlugin::INTERNAL_FILEID_PROPERTYNAME: + return 'fileid'; default: throw new \InvalidArgumentException('Unsupported property for search or order: ' . $propertyName); } @@ -266,7 +268,7 @@ class FileSearchBackend implements ISearchBackend { return 0 + $value; } $date = \DateTime::createFromFormat(\DateTime::ATOM, $value); - return ($date instanceof \DateTime) ? $date->getTimestamp() : 0; + return ($date instanceof \DateTime) ? $date->getTimestamp() : 0; default: return $value; } |