server/lib/private/files/stream/dir.php
Thomas Müller 9c9dc276b7 move the private namespace OC into lib/private - OCP will stay in lib/public
Conflicts:
	lib/private/vcategories.php
2013-09-30 16:36:59 +02:00

47 lines
971 B
PHP

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