diff --git a/lib/CalDAV/CalendarObject.php b/lib/CalDAV/CalendarObject.php index 671f4b5dbc..e49813d5c3 100644 --- a/lib/CalDAV/CalendarObject.php +++ b/lib/CalDAV/CalendarObject.php @@ -95,7 +95,7 @@ public function get() * * @return string */ - public function put($calendarData) + public function put($calendarData,$params=null) { if (is_resource($calendarData)) { $calendarData = stream_get_contents($calendarData); diff --git a/lib/CalDAV/Schedule/SchedulingObject.php b/lib/CalDAV/Schedule/SchedulingObject.php index b40f28a947..2a23b36033 100644 --- a/lib/CalDAV/Schedule/SchedulingObject.php +++ b/lib/CalDAV/Schedule/SchedulingObject.php @@ -62,7 +62,7 @@ public function get() * * @return string */ - public function put($calendarData) + public function put($calendarData,$params=null) { throw new MethodNotAllowed('Updating scheduling objects is not supported'); } diff --git a/lib/CardDAV/Card.php b/lib/CardDAV/Card.php index c9cd2bbf61..8f4114d9d4 100644 --- a/lib/CardDAV/Card.php +++ b/lib/CardDAV/Card.php @@ -82,7 +82,7 @@ public function get() * * @return string|null */ - public function put($cardData) + public function put($cardData,$params=null) { if (is_resource($cardData)) { $cardData = stream_get_contents($cardData); diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php index 74350c28d6..8568b4dcba 100644 --- a/lib/DAV/CorePlugin.php +++ b/lib/DAV/CorePlugin.php @@ -429,6 +429,7 @@ public function httpPut(RequestInterface $request, ResponseInterface $response) { $body = $request->getBodyAsStream(); $path = $request->getPath(); + $params = (object) array('versioning' => $request->getHeader('versioning')); // Intercepting Content-Range if ($request->getHeader('Content-Range')) { @@ -489,7 +490,7 @@ public function httpPut(RequestInterface $request, ResponseInterface $response) if (!($node instanceof IFile)) { throw new Exception\Conflict('PUT is not allowed on non-files.'); } - if (!$this->server->updateFile($path, $body, $etag)) { + if (!$this->server->updateFile($path, $body, $etag,$params)) { return false; } diff --git a/lib/DAV/FS/File.php b/lib/DAV/FS/File.php index b78a801389..b6c7149179 100644 --- a/lib/DAV/FS/File.php +++ b/lib/DAV/FS/File.php @@ -20,7 +20,7 @@ class File extends Node implements DAV\IFile * * @param resource $data */ - public function put($data) + public function put($data,$params=null) { file_put_contents($this->path, $data); clearstatcache(true, $this->path); diff --git a/lib/DAV/FSExt/File.php b/lib/DAV/FSExt/File.php index 74849b564e..d249b52418 100644 --- a/lib/DAV/FSExt/File.php +++ b/lib/DAV/FSExt/File.php @@ -25,7 +25,7 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport * * @return string */ - public function put($data) + public function put($data,$params=null) { file_put_contents($this->path, $data); clearstatcache(true, $this->path); diff --git a/lib/DAV/File.php b/lib/DAV/File.php index daf83aa4d8..ca203d77f4 100644 --- a/lib/DAV/File.php +++ b/lib/DAV/File.php @@ -37,7 +37,7 @@ abstract class File extends Node implements IFile * * @return string|null */ - public function put($data) + public function put($data,$params=null) { throw new Exception\Forbidden('Permission denied to change data'); } diff --git a/lib/DAV/IFile.php b/lib/DAV/IFile.php index 974aee00dd..00b316ff2e 100644 --- a/lib/DAV/IFile.php +++ b/lib/DAV/IFile.php @@ -38,7 +38,7 @@ interface IFile extends INode * * @return string|null */ - public function put($data); + public function put($data,$params=null); /** * Returns the data. diff --git a/lib/DAV/Server.php b/lib/DAV/Server.php index 1f8300d4a5..226a07cab2 100644 --- a/lib/DAV/Server.php +++ b/lib/DAV/Server.php @@ -1120,7 +1120,7 @@ public function createFile($uri, $data, &$etag = null) * * @return bool */ - public function updateFile($uri, $data, &$etag = null) + public function updateFile($uri, $data, &$etag = null,$params) { $node = $this->tree->getNodeForPath($uri); @@ -1133,8 +1133,7 @@ public function updateFile($uri, $data, &$etag = null) if (!$this->emit('beforeWriteContent', [$uri, $node, &$data, &$modified])) { return false; } - - $etag = $node->put($data); + $etag = $node->put($data,$params); if ($modified) { $etag = null; }