Fix retrieving of shared source paths
This commit is contained in:
parent
8bdfb04056
commit
fb053f8e73
1 changed files with 28 additions and 13 deletions
|
@ -38,19 +38,34 @@ class Shared extends \OC\Files\Storage\Common {
|
||||||
return 'shared::' . $this->sharedFolder;
|
return 'shared::' . $this->sharedFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the source file path, permissions, and owner for a shared file
|
||||||
|
* @param string Shared target file path
|
||||||
|
* @return Returns array with the keys path, permissions, and owner or false if not found
|
||||||
|
*/
|
||||||
|
private function getFile($target) {
|
||||||
|
if (!isset($this->files[$target])) {
|
||||||
|
$source = \OC_Share_Backend_File::getSource($target);
|
||||||
|
if ($source) {
|
||||||
|
$source['path'] = '/'.$source['uid_owner'].'/'.$source['path'];
|
||||||
|
}
|
||||||
|
$this->files[$target] = $source;
|
||||||
|
}
|
||||||
|
return $this->files[$target];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the source file path for a shared file
|
* @brief Get the source file path for a shared file
|
||||||
* @param string Shared target file path
|
* @param string Shared target file path
|
||||||
* @return string source file path or false if not found
|
* @return string source file path or false if not found
|
||||||
*/
|
*/
|
||||||
private function getSourcePath($target) {
|
private function getSourcePath($target) {
|
||||||
if (!isset($this->files[$target])) {
|
$source = $this->getFile($target);
|
||||||
$source = \OC_Share_Backend_File::getSource($target);
|
if ($source) {
|
||||||
$source['path'] = '/'.$source['uid_owner'].'/'.$source['path'];
|
|
||||||
$this->files[$target] = $source;
|
|
||||||
\OC\Files\Filesystem::initMountPoints($source['uid_owner']);
|
\OC\Files\Filesystem::initMountPoints($source['uid_owner']);
|
||||||
|
return $source['path'];
|
||||||
}
|
}
|
||||||
return $this->files[$target]['path'];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,11 +74,11 @@ class Shared extends \OC\Files\Storage\Common {
|
||||||
* @return int CRUDS permissions granted or false if not found
|
* @return int CRUDS permissions granted or false if not found
|
||||||
*/
|
*/
|
||||||
public function getPermissions($target) {
|
public function getPermissions($target) {
|
||||||
if (!isset($this->files[$target])) {
|
$source = $this->getFile($target);
|
||||||
$source = \OC_Share_Backend_File::getSource($target);
|
if ($source) {
|
||||||
$this->files[$target] = $source;
|
return $source['permissions'];
|
||||||
}
|
}
|
||||||
return $this->files[$target]['permissions'];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mkdir($path) {
|
public function mkdir($path) {
|
||||||
|
@ -389,11 +404,11 @@ class Shared extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOwner($path) {
|
public function getOwner($path) {
|
||||||
if (!isset($this->files[$path])) {
|
$source = $this->getFile($path);
|
||||||
$source = \OC_Share_Backend_File::getSource($path);
|
if ($source) {
|
||||||
$this->files[$path] = $source;
|
return $source['uid_owner'];
|
||||||
}
|
}
|
||||||
return $this->files[$path]['uid_owner'];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getETag($path) {
|
public function getETag($path) {
|
||||||
|
|
Loading…
Reference in a new issue