Merge pull request #7075 from owncloud/quota-storagexsendfile

Added isLocal() method to storage, used for xsendfile
This commit is contained in:
Vincent Petry 2014-02-11 14:49:39 +01:00
commit c442a03d3a
5 changed files with 36 additions and 1 deletions

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -298,5 +298,12 @@ if (\OC_Util::runningOnWindows()) {
public function hasUpdated($path, $time) {
return $this->filemtime($path) > $time;
}
/**
* {@inheritdoc}
*/
public function isLocal() {
return true;
}
}
}

View File

@ -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();
}
}

View File

@ -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();
}