diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2021-12-28 12:13:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-28 12:13:38 +0300 |
commit | 66ca9baed292e30e2354df0aa4f65742f27c28ce (patch) | |
tree | 37857a32d96ad7034e4d59967750e6c22b65991c /apps/dav/lib/Connector/Sabre | |
parent | 6e906dedc67dde6d88420fb3a5e891b8231a4bd8 (diff) | |
parent | 01be1447be254d0d1a6dd204ddc403bb18a1cadf (diff) |
Merge pull request #29948 from nextcloud/enh/webdav-creationdate
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-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; |