diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-02-12 13:21:47 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-02-12 13:21:47 +0100 |
commit | 60bd9d512dd37c4eec684d1aef755e1c3e7d18f5 (patch) | |
tree | 3e3e90798e97d80cf3aec4de541c107fe9577d92 /lib | |
parent | a6399f9ceffcf9865b8a2be155dc4f98bd2ee5dc (diff) | |
parent | 3699728a3a02dd17ea617a7e8f781c09e837f360 (diff) | |
download | nextcloud-server-60bd9d512dd37c4eec684d1aef755e1c3e7d18f5.tar.gz nextcloud-server-60bd9d512dd37c4eec684d1aef755e1c3e7d18f5.zip |
Merge branch 'master' into backgroundjob-public
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files.php | 2 | ||||
-rw-r--r-- | lib/private/files/storage/common.php | 9 | ||||
-rw-r--r-- | lib/private/files/storage/local.php | 7 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/wrapper.php | 8 | ||||
-rw-r--r-- | lib/public/files/storage.php | 11 |
5 files changed, 36 insertions, 1 deletions
diff --git a/lib/private/files.php b/lib/private/files.php index 8ce632013cf..24fca4a5df3 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -131,7 +131,7 @@ class OC_Files { } if ($xsendfile) { list($storage) = \OC\Files\Filesystem::resolvePath(\OC\Files\Filesystem::getView()->getAbsolutePath($filename)); - if ($storage instanceof \OC\Files\Storage\Local) { + if ($storage->isLocal()) { self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename)); } } 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(); + } } diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php index 194b42a6481..fe30f8f50af 100644 --- a/lib/public/files/storage.php +++ b/lib/public/files/storage.php @@ -315,4 +315,15 @@ interface Storage { * @return string */ public function getETag($path); + + /** + * Returns whether the storage is local, which means that files + * are stored on the local filesystem instead of remotely. + * Calling getLocalFile() for local storages should always + * return the local files, whereas for non-local storages + * it might return a temporary file. + * + * @return bool true if the files are stored locally, false otherwise + */ + public function isLocal(); } |