diff options
author | Henrik Kjölhede <hkjolhede@gmail.com> | 2013-02-09 14:05:33 +0100 |
---|---|---|
committer | Henrik Kjölhede <hkjolhede@gmail.com> | 2013-02-09 14:05:33 +0100 |
commit | 41fa65e7befb249e260f2dd91e33971261cfd302 (patch) | |
tree | 4ebb4cb10f7869ba3288308ca3a35ce53970ed40 /lib/files/stream/dir.php | |
parent | b1b2eafa50db54b2613cf2bc52bfab2015d67b2f (diff) | |
parent | ec829bd345045df985f623fa2fe6587d0ce68eb2 (diff) | |
download | nextcloud-server-41fa65e7befb249e260f2dd91e33971261cfd302.tar.gz nextcloud-server-41fa65e7befb249e260f2dd91e33971261cfd302.zip |
Merge branch 'master' of https://github.com/owncloud/core
Conflicts:
apps/files_external/appinfo/app.php
Diffstat (limited to 'lib/files/stream/dir.php')
-rw-r--r-- | lib/files/stream/dir.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/files/stream/dir.php b/lib/files/stream/dir.php new file mode 100644 index 00000000000..6ca884fc994 --- /dev/null +++ b/lib/files/stream/dir.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\Files\Stream; + +class Dir { + private static $dirs = array(); + private $name; + private $index; + + public function dir_opendir($path, $options) { + $this->name = substr($path, strlen('fakedir://')); + $this->index = 0; + if (!isset(self::$dirs[$this->name])) { + self::$dirs[$this->name] = array(); + } + return true; + } + + public function dir_readdir() { + if ($this->index >= count(self::$dirs[$this->name])) { + return false; + } + $filename = self::$dirs[$this->name][$this->index]; + $this->index++; + return $filename; + } + + public function dir_closedir() { + $this->name = ''; + return true; + } + + public function dir_rewinddir() { + $this->index = 0; + return true; + } + + public static function register($path, $content) { + self::$dirs[$path] = $content; + } +} |