diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-11-29 11:25:48 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-11-29 11:25:48 +0100 |
commit | 01be1447be254d0d1a6dd204ddc403bb18a1cadf (patch) | |
tree | a424eb170eef985a0512bbe36509f2939d63e5ea /apps/dav/lib | |
parent | 03b424af19f187f0988b96b16e548928940610c9 (diff) | |
download | nextcloud-server-01be1447be254d0d1a6dd204ddc403bb18a1cadf.tar.gz nextcloud-server-01be1447be254d0d1a6dd204ddc403bb18a1cadf.zip |
Expose DAV:creationdate for propfind/proppatch
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/FilesPlugin.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 156507e4467..95f3db9a65b 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -65,6 +65,7 @@ class FilesPlugin extends ServerPlugin { public const SIZE_PROPERTYNAME = '{http://owncloud.org/ns}size'; public const GETETAG_PROPERTYNAME = '{DAV:}getetag'; public const LASTMODIFIED_PROPERTYNAME = '{DAV:}lastmodified'; + public const CREATIONDATE_PROPERTYNAME = '{DAV:}creationdate'; public const OWNER_ID_PROPERTYNAME = '{http://owncloud.org/ns}owner-id'; public const OWNER_DISPLAY_NAME_PROPERTYNAME = '{http://owncloud.org/ns}owner-display-name'; public const CHECKSUMS_PROPERTYNAME = '{http://owncloud.org/ns}checksums'; @@ -395,6 +396,11 @@ class FilesPlugin extends ServerPlugin { $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function () use ($node) { return $this->config->getSystemValue('data-fingerprint', ''); }); + $propFind->handle(self::CREATIONDATE_PROPERTYNAME, function () use ($node) { + return (new \DateTimeImmutable()) + ->setTimestamp($node->getFileInfo()->getCreationTime()) + ->format(\DateTimeInterface::ATOM); + }); $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function () use ($node) { return $node->getFileInfo()->getCreationTime(); }); @@ -495,6 +501,14 @@ class FilesPlugin extends ServerPlugin { } return false; }); + $propPatch->handle(self::CREATIONDATE_PROPERTYNAME, function ($time) use ($node) { + if (empty($time)) { + return false; + } + $dateTime = new \DateTimeImmutable($time); + $node->setCreationTime($dateTime->getTimestamp()); + return true; + }); $propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function ($time) use ($node) { if (empty($time)) { return false; |