summaryrefslogtreecommitdiffstats
path: root/lib/private/files/stream
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/stream')
-rw-r--r--lib/private/files/stream/quota.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/files/stream/quota.php b/lib/private/files/stream/quota.php
index 53d8a03d30f..87301c23614 100644
--- a/lib/private/files/stream/quota.php
+++ b/lib/private/files/stream/quota.php
@@ -66,12 +66,22 @@ class Quota {
}
public function stream_seek($offset, $whence = SEEK_SET) {
- if ($whence === SEEK_SET) {
+ if ($whence === SEEK_END){
+ // go to the end to find out last position's offset
+ $oldOffset = $this->stream_tell();
+ if (fseek($this->source, 0, $whence) !== 0){
+ return false;
+ }
+ $whence = SEEK_SET;
+ $offset = $this->stream_tell() + $offset;
+ $this->limit += $oldOffset - $offset;
+ }
+ else if ($whence === SEEK_SET) {
$this->limit += $this->stream_tell() - $offset;
} else {
$this->limit -= $offset;
}
- fseek($this->source, $offset, $whence);
+ return !fseek($this->source, $offset, $whence);
}
public function stream_tell() {