summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoricewind1991 <icewind1991@gmail.com>2013-06-28 12:24:33 -0700
committericewind1991 <icewind1991@gmail.com>2013-06-28 12:24:33 -0700
commit30a403e327cd02dcf6acddd98e6a0837281cea9f (patch)
tree7805d5b67f06254ee61d4c6e84dbf7c86d66ead9 /lib
parente3df2b8c873a4a03156714bf09f1ed7c98129f4f (diff)
parenta0d83771094df4d3a7d27ee72b9abb4a6854b604 (diff)
downloadnextcloud-server-30a403e327cd02dcf6acddd98e6a0837281cea9f.tar.gz
nextcloud-server-30a403e327cd02dcf6acddd98e6a0837281cea9f.zip
Merge pull request #3892 from owncloud/static-streamwrapper
Improvements for the static:// streamwrapper
Diffstat (limited to 'lib')
-rw-r--r--lib/files/stream/staticstream.php55
1 files changed, 10 insertions, 45 deletions
diff --git a/lib/files/stream/staticstream.php b/lib/files/stream/staticstream.php
index 7725a6a5a04..45b1a7a81f8 100644
--- a/lib/files/stream/staticstream.php
+++ b/lib/files/stream/staticstream.php
@@ -9,6 +9,8 @@
namespace OC\Files\Stream;
class StaticStream {
+ const MODE_FILE = 0100000;
+
public $context;
protected static $data = array();
@@ -26,6 +28,10 @@ class StaticStream {
public function stream_flush() {
}
+ public static function clear() {
+ self::$data = array();
+ }
+
public function stream_open($path, $mode, $options, &$opened_path) {
switch ($mode[0]) {
case 'r':
@@ -94,36 +100,7 @@ class StaticStream {
}
public function stream_stat() {
- $size = strlen(self::$data[$this->path]);
- $time = time();
- return array(
- 0 => 0,
- 'dev' => 0,
- 1 => 0,
- 'ino' => 0,
- 2 => 0777,
- 'mode' => 0777,
- 3 => 1,
- 'nlink' => 1,
- 4 => 0,
- 'uid' => 0,
- 5 => 0,
- 'gid' => 0,
- 6 => '',
- 'rdev' => '',
- 7 => $size,
- 'size' => $size,
- 8 => $time,
- 'atime' => $time,
- 9 => $time,
- 'mtime' => $time,
- 10 => $time,
- 'ctime' => $time,
- 11 => -1,
- 'blksize' => -1,
- 12 => -1,
- 'blocks' => -1,
- );
+ return $this->url_stat($this->path);
}
public function stream_tell() {
@@ -157,34 +134,22 @@ class StaticStream {
if (isset(self::$data[$path])) {
$size = strlen(self::$data[$path]);
$time = time();
- return array(
- 0 => 0,
+ $data = array(
'dev' => 0,
- 1 => 0,
'ino' => 0,
- 2 => 0777,
- 'mode' => 0777,
- 3 => 1,
+ 'mode' => self::MODE_FILE | 0777,
'nlink' => 1,
- 4 => 0,
'uid' => 0,
- 5 => 0,
'gid' => 0,
- 6 => '',
'rdev' => '',
- 7 => $size,
'size' => $size,
- 8 => $time,
'atime' => $time,
- 9 => $time,
'mtime' => $time,
- 10 => $time,
'ctime' => $time,
- 11 => -1,
'blksize' => -1,
- 12 => -1,
'blocks' => -1,
);
+ return array_values($data) + $data;
}
return false;
}