Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-11-29 13:25:48 +0300
committerJulius Härtl <jus@bitgrid.net>2021-11-29 13:25:48 +0300
commit01be1447be254d0d1a6dd204ddc403bb18a1cadf (patch)
treea424eb170eef985a0512bbe36509f2939d63e5ea /apps/dav/lib/Connector/Sabre
parent03b424af19f187f0988b96b16e548928940610c9 (diff)
Expose DAV:creationdate for propfind/proppatch
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php14
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;