From e706cf6c06a0111f9ec5db65e46f0fcc9261b456 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 13 Jan 2014 15:57:49 +0100 Subject: [PATCH] add Support for passing a FileInfo instance to View->putFileInfo --- lib/private/files/fileinfo.php | 4 ++++ lib/private/files/view.php | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php index 8e9b6a8b72..b80873d1d0 100644 --- a/lib/private/files/fileinfo.php +++ b/lib/private/files/fileinfo.php @@ -146,4 +146,8 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess, \JsonSerializable { public function getType() { return $this->data['type']; } + + public function getData(){ + return $this->data; + } } diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 39c2ffed93..b587027966 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -963,12 +963,15 @@ class View { * change file metadata * * @param string $path - * @param array $data + * @param array | \OCP\Files\FileInfo $data * @return int * * returns the fileid of the updated file */ public function putFileInfo($path, $data) { + if ($data instanceof FileInfo) { + $data = $data->getData(); + } $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); /** * @var \OC\Files\Storage\Storage $storage