add Support for passing a FileInfo instance to View->putFileInfo

This commit is contained in:
Robin Appelman 2014-01-13 15:57:49 +01:00
parent 82762bb462
commit e706cf6c06
2 changed files with 8 additions and 1 deletions

View File

@ -146,4 +146,8 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess, \JsonSerializable {
public function getType() { public function getType() {
return $this->data['type']; return $this->data['type'];
} }
public function getData(){
return $this->data;
}
} }

View File

@ -963,12 +963,15 @@ class View {
* change file metadata * change file metadata
* *
* @param string $path * @param string $path
* @param array $data * @param array | \OCP\Files\FileInfo $data
* @return int * @return int
* *
* returns the fileid of the updated file * returns the fileid of the updated file
*/ */
public function putFileInfo($path, $data) { public function putFileInfo($path, $data) {
if ($data instanceof FileInfo) {
$data = $data->getData();
}
$path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
/** /**
* @var \OC\Files\Storage\Storage $storage * @var \OC\Files\Storage\Storage $storage