diff --git a/lib/CalDAV/CalendarObject.php b/lib/CalDAV/CalendarObject.php index 1fb042d23b..671f4b5dbc 100644 --- a/lib/CalDAV/CalendarObject.php +++ b/lib/CalDAV/CalendarObject.php @@ -92,11 +92,10 @@ public function get() * Updates the ICalendar-formatted object. * * @param string|resource $calendarData - * @param object|null $params * * @return string */ - public function put($calendarData, $params = null) + public function put($calendarData) { if (is_resource($calendarData)) { $calendarData = stream_get_contents($calendarData); diff --git a/lib/CalDAV/Schedule/SchedulingObject.php b/lib/CalDAV/Schedule/SchedulingObject.php index 532fd8b06a..b40f28a947 100644 --- a/lib/CalDAV/Schedule/SchedulingObject.php +++ b/lib/CalDAV/Schedule/SchedulingObject.php @@ -59,11 +59,10 @@ public function get() * Updates the ICalendar-formatted object. * * @param string|resource $calendarData - * @param object|null $params * * @return string */ - public function put($calendarData, $params = null) + public function put($calendarData) { throw new MethodNotAllowed('Updating scheduling objects is not supported'); } diff --git a/lib/CardDAV/Card.php b/lib/CardDAV/Card.php index 44bbf3c2d3..c9cd2bbf61 100644 --- a/lib/CardDAV/Card.php +++ b/lib/CardDAV/Card.php @@ -78,12 +78,11 @@ public function get() /** * Updates the VCard-formatted object. * - * @param string $cardData - * @param object|null $params + * @param string $cardData * * @return string|null */ - public function put($cardData, $params = null) + public function put($cardData) { if (is_resource($cardData)) { $cardData = stream_get_contents($cardData); diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php index afb424f770..74350c28d6 100644 --- a/lib/DAV/CorePlugin.php +++ b/lib/DAV/CorePlugin.php @@ -429,7 +429,6 @@ public function httpPut(RequestInterface $request, ResponseInterface $response) { $body = $request->getBodyAsStream(); $path = $request->getPath(); - $params = (object) ['versioning' => $request->getHeader('versioning')]; // Intercepting Content-Range if ($request->getHeader('Content-Range')) { @@ -490,7 +489,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, $params)) { + if (!$this->server->updateFile($path, $body, $etag)) { return false; } diff --git a/lib/DAV/FS/File.php b/lib/DAV/FS/File.php index 2fb96d0820..b78a801389 100644 --- a/lib/DAV/FS/File.php +++ b/lib/DAV/FS/File.php @@ -18,10 +18,9 @@ class File extends Node implements DAV\IFile /** * Updates the data. * - * @param resource $data - * @param object|null $params + * @param resource $data */ - public function put($data, $params = null) + public function put($data) { 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 a867b95c67..74849b564e 100644 --- a/lib/DAV/FSExt/File.php +++ b/lib/DAV/FSExt/File.php @@ -22,11 +22,10 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport * Data is a readable stream resource. * * @param resource|string $data - * @param object|null $params * * @return string */ - public function put($data, $params = null) + public function put($data) { file_put_contents($this->path, $data); clearstatcache(true, $this->path); diff --git a/lib/DAV/File.php b/lib/DAV/File.php index 42ec3e8b95..daf83aa4d8 100644 --- a/lib/DAV/File.php +++ b/lib/DAV/File.php @@ -34,11 +34,10 @@ abstract class File extends Node implements IFile * return an ETag, and just return null. * * @param string|resource $data - * @param object|null $params * * @return string|null */ - public function put($data, $params = null) + public function put($data) { throw new Exception\Forbidden('Permission denied to change data'); } diff --git a/lib/DAV/IFile.php b/lib/DAV/IFile.php index c96b62d9f6..974aee00dd 100644 --- a/lib/DAV/IFile.php +++ b/lib/DAV/IFile.php @@ -35,11 +35,10 @@ interface IFile extends INode * return an ETag, and just return null. * * @param resource|string $data - * @param object|null $params * * @return string|null */ - public function put($data, $params = null); + public function put($data); /** * Returns the data. diff --git a/lib/DAV/Server.php b/lib/DAV/Server.php index 883e219a5f..1f8300d4a5 100644 --- a/lib/DAV/Server.php +++ b/lib/DAV/Server.php @@ -1114,14 +1114,13 @@ public function createFile($uri, $data, &$etag = null) * * This method will return true if the file was actually updated * - * @param string $uri - * @param resource $data - * @param string $etag - * @param object|null $params + * @param string $uri + * @param resource $data + * @param string $etag * * @return bool */ - public function updateFile($uri, $data, &$etag = null, $params = null) + public function updateFile($uri, $data, &$etag = null) { $node = $this->tree->getNodeForPath($uri); @@ -1134,7 +1133,8 @@ public function updateFile($uri, $data, &$etag = null, $params = null) if (!$this->emit('beforeWriteContent', [$uri, $node, &$data, &$modified])) { return false; } - $etag = $node->put($data, $params); + + $etag = $node->put($data); if ($modified) { $etag = null; } diff --git a/tests/Sabre/DAV/Mock/File.php b/tests/Sabre/DAV/Mock/File.php index cf4a7fed3c..d48ddaa922 100644 --- a/tests/Sabre/DAV/Mock/File.php +++ b/tests/Sabre/DAV/Mock/File.php @@ -82,12 +82,11 @@ public function setName($name) * different object on a subsequent GET you are strongly recommended to not * return an ETag, and just return null. * - * @param resource $data - * @param object|null $params + * @param resource $data * * @return string|null */ - public function put($data, $params = null) + public function put($data) { if (is_resource($data)) { $data = stream_get_contents($data); diff --git a/tests/Sabre/DAV/Mock/StreamingFile.php b/tests/Sabre/DAV/Mock/StreamingFile.php index 1815f81f3d..951327e334 100644 --- a/tests/Sabre/DAV/Mock/StreamingFile.php +++ b/tests/Sabre/DAV/Mock/StreamingFile.php @@ -35,12 +35,11 @@ class StreamingFile extends File * different object on a subsequent GET you are strongly recommended to not * return an ETag, and just return null. * - * @param resource $data - * @param object|null $params + * @param resource $data * * @return string|null */ - public function put($data, $params = null) + public function put($data) { if (is_string($data)) { $stream = fopen('php://memory', 'r+'); diff --git a/tests/Sabre/DAV/PartialUpdate/FileMock.php b/tests/Sabre/DAV/PartialUpdate/FileMock.php index 374c32fbd0..72fdb5ec84 100644 --- a/tests/Sabre/DAV/PartialUpdate/FileMock.php +++ b/tests/Sabre/DAV/PartialUpdate/FileMock.php @@ -10,12 +10,12 @@ class FileMock implements IPatchSupport { protected $data = ''; - public function put($data, $params = null) + public function put($str) { - if (is_resource($data)) { - $data = stream_get_contents($data); + if (is_resource($str)) { + $str = stream_get_contents($str); } - $this->data = $data; + $this->data = $str; } /**