Merge pull request #5995 from owncloud/extstorage-isreadablefix

Return plausible isReadable() default impl for ext storage
This commit is contained in:
Vincent Petry 2013-11-24 03:04:33 -08:00
commit aef34618de
8 changed files with 13 additions and 52 deletions

View File

@ -300,14 +300,6 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return false;
}
public function isReadable($path) {
return true;
}
public function isUpdatable($path) {
return true;
}
public function unlink($path) {
$path = $this->normalizePath($path);

View File

@ -146,14 +146,6 @@ class Dropbox extends \OC\Files\Storage\Common {
return false;
}
public function isReadable($path) {
return $this->file_exists($path);
}
public function isUpdatable($path) {
return $this->file_exists($path);
}
public function file_exists($path) {
if ($path == '' || $path == '/') {
return true;

View File

@ -317,10 +317,6 @@ class Google extends \OC\Files\Storage\Common {
}
}
public function isReadable($path) {
return $this->file_exists($path);
}
public function isUpdatable($path) {
$file = $this->getDriveFile($path);
if ($file) {

View File

@ -180,14 +180,6 @@ class SFTP extends \OC\Files\Storage\Common {
return false;
}
public function isReadable($path) {
return true;
}
public function isUpdatable($path) {
return true;
}
public function file_exists($path) {
try {
return $this->client->stat($this->absPath($path)) !== false;

View File

@ -41,14 +41,6 @@ abstract class StreamWrapper extends Common {
return filetype($this->constructUrl($path));
}
public function isReadable($path) {
return true; //not properly supported
}
public function isUpdatable($path) {
return true; //not properly supported
}
public function file_exists($path) {
return file_exists($this->constructUrl($path));
}

View File

@ -268,14 +268,6 @@ class Swift extends \OC\Files\Storage\Common {
}
}
public function isReadable($path) {
return true;
}
public function isUpdatable($path) {
return true;
}
public function unlink($path) {
$path = $this->normalizePath($path);

View File

@ -134,14 +134,6 @@ class DAV extends \OC\Files\Storage\Common{
}
}
public function isReadable($path) {
return true;//not properly supported
}
public function isUpdatable($path) {
return true;//not properly supported
}
public function file_exists($path) {
$this->init();
$path=$this->cleanPath($path);

View File

@ -51,6 +51,19 @@ abstract class Common implements \OC\Files\Storage\Storage {
}
}
public function isReadable($path) {
// at least check whether it exists
// subclasses might want to implement this more thoroughly
return $this->file_exists($path);
}
public function isUpdatable($path) {
// at least check whether it exists
// subclasses might want to implement this more thoroughly
// a non-existing file/folder isn't updatable
return $this->file_exists($path);
}
public function isCreatable($path) {
if ($this->is_dir($path) && $this->isUpdatable($path)) {
return true;