summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-02-04 19:58:49 +0100
committerVincent Petry <pvince81@owncloud.com>2014-02-06 20:53:15 +0100
commit788c8540aa6aac50795c37b088eeaa561d44b86c (patch)
treee20e28f38477c4bf2d6412ee8a77f3eb806b5bff /lib/private/files
parentbe47e156a5afee8a20f60d278aab45bb84c282c2 (diff)
downloadnextcloud-server-788c8540aa6aac50795c37b088eeaa561d44b86c.tar.gz
nextcloud-server-788c8540aa6aac50795c37b088eeaa561d44b86c.zip
Added isLocal() method to storage, used for xsendfile
Added isLocal() method to Storage to find out whether the storage is local or not. This method is used for the x-sendfile logic to find out whether to add the headers.
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/storage/common.php9
-rw-r--r--lib/private/files/storage/local.php7
-rw-r--r--lib/private/files/storage/wrapper/wrapper.php8
3 files changed, 24 insertions, 0 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 678bf419023..55b1471593d 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -370,4 +370,13 @@ abstract class Common implements \OC\Files\Storage\Storage {
public function free_space($path) {
return \OC\Files\SPACE_UNKNOWN;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isLocal() {
+ // the common implementation returns a temporary file by
+ // default, which is not local
+ return false;
+ }
}
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index db3c6bfca3a..fa0788f2377 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -298,5 +298,12 @@ if (\OC_Util::runningOnWindows()) {
public function hasUpdated($path, $time) {
return $this->filemtime($path) > $time;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isLocal() {
+ return true;
+ }
}
}
diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php
index f9adda80314..11ea9f71da7 100644
--- a/lib/private/files/storage/wrapper/wrapper.php
+++ b/lib/private/files/storage/wrapper/wrapper.php
@@ -432,4 +432,12 @@ class Wrapper implements \OC\Files\Storage\Storage {
public function test() {
return $this->storage->test();
}
+
+ /**
+ * Returns the wrapped storage's value for isLocal()
+ * @return bool wrapped storage's isLocal() value
+ */
+ public function isLocal() {
+ return $this->storage->isLocal();
+ }
}