|
|
|
@ -24,10 +24,10 @@ |
|
|
|
|
* Convert target path to source path and pass the function call to the correct storage provider |
|
|
|
|
*/ |
|
|
|
|
class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private $sharedFolder; |
|
|
|
|
private $files = array(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct($arguments) { |
|
|
|
|
$this->sharedFolder = $arguments['sharedFolder']; |
|
|
|
|
OC_Util::setupFS4all(); |
|
|
|
@ -106,17 +106,17 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
$internalPath = substr($path, strlen($mountPoint)); |
|
|
|
|
return $internalPath; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function mkdir($path) { |
|
|
|
|
if ($path == '' || $path == '/' || !$this->isCreatable(dirname($path))) { |
|
|
|
|
return false; |
|
|
|
|
return false; |
|
|
|
|
} else if ($source = $this->getSourcePath($path)) { |
|
|
|
|
$storage = OC_Filesystem::getStorage($source); |
|
|
|
|
return $storage->mkdir($this->getInternalPath($source)); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function rmdir($path) { |
|
|
|
|
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) { |
|
|
|
|
$storage = OC_Filesystem::getStorage($source); |
|
|
|
@ -124,7 +124,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function opendir($path) { |
|
|
|
|
if ($path == '' || $path == '/') { |
|
|
|
|
$files = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_Folder::FORMAT_OPENDIR); |
|
|
|
@ -229,10 +229,10 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function filectime($path) { |
|
|
|
|
if ($path == '' || $path == '/') { |
|
|
|
|
$ctime = 0; |
|
|
|
|
$ctime = 0; |
|
|
|
|
if ($dh = $this->opendir($path)) { |
|
|
|
|
while (($filename = readdir($dh)) !== false) { |
|
|
|
|
$tempctime = $this->filectime($filename); |
|
|
|
@ -250,10 +250,10 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function filemtime($path) { |
|
|
|
|
if ($path == '' || $path == '/') { |
|
|
|
|
$mtime = 0; |
|
|
|
|
$mtime = 0; |
|
|
|
|
if ($dh = $this->opendir($path)) { |
|
|
|
|
while (($filename = readdir($dh)) !== false) { |
|
|
|
|
$tempmtime = $this->filemtime($filename); |
|
|
|
@ -271,7 +271,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function file_get_contents($path) { |
|
|
|
|
$source = $this->getSourcePath($path); |
|
|
|
|
if ($source) { |
|
|
|
@ -284,7 +284,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
return $storage->file_get_contents($this->getInternalPath($source)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function file_put_contents($path, $data) { |
|
|
|
|
if ($source = $this->getSourcePath($path)) { |
|
|
|
|
// Check if permission is granted |
|
|
|
@ -302,7 +302,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function unlink($path) { |
|
|
|
|
// Delete the file if DELETE permission is granted |
|
|
|
|
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) { |
|
|
|
@ -311,7 +311,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function rename($path1, $path2) { |
|
|
|
|
// Renaming/moving is only allowed within shared folders |
|
|
|
|
$pos1 = strpos($path1, '/', 1); |
|
|
|
@ -344,7 +344,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function copy($path1, $path2) { |
|
|
|
|
// Copy the file if CREATE permission is granted |
|
|
|
|
if ($this->isCreatable(dirname($path2))) { |
|
|
|
|