Merge pull request #7075 from owncloud/quota-storagexsendfile
Added isLocal() method to storage, used for xsendfile
This commit is contained in:
commit
c442a03d3a
|
@ -131,7 +131,7 @@ class OC_Files {
|
||||||
}
|
}
|
||||||
if ($xsendfile) {
|
if ($xsendfile) {
|
||||||
list($storage) = \OC\Files\Filesystem::resolvePath(\OC\Files\Filesystem::getView()->getAbsolutePath($filename));
|
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));
|
self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,4 +370,13 @@ abstract class Common implements \OC\Files\Storage\Storage {
|
||||||
public function free_space($path) {
|
public function free_space($path) {
|
||||||
return \OC\Files\SPACE_UNKNOWN;
|
return \OC\Files\SPACE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function isLocal() {
|
||||||
|
// the common implementation returns a temporary file by
|
||||||
|
// default, which is not local
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,5 +298,12 @@ if (\OC_Util::runningOnWindows()) {
|
||||||
public function hasUpdated($path, $time) {
|
public function hasUpdated($path, $time) {
|
||||||
return $this->filemtime($path) > $time;
|
return $this->filemtime($path) > $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function isLocal() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,4 +432,12 @@ class Wrapper implements \OC\Files\Storage\Storage {
|
||||||
public function test() {
|
public function test() {
|
||||||
return $this->storage->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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,4 +315,15 @@ interface Storage {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getETag($path);
|
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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue