diff options
Diffstat (limited to 'apps/files_external/3rdparty/icewind/streams/src/Wrapper.php')
-rw-r--r-- | apps/files_external/3rdparty/icewind/streams/src/Wrapper.php | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php index 2e3a6e6cd88..53de2942ca9 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php @@ -12,7 +12,7 @@ namespace Icewind\Streams; * * This wrapper itself doesn't implement any functionality but is just a base class for other wrappers to extend */ -abstract class Wrapper implements File { +abstract class Wrapper implements File, Directory { /** * @var resource */ @@ -25,6 +25,22 @@ abstract class Wrapper implements File { */ protected $source; + protected static function wrapSource($source, $context, $protocol, $class) { + try { + stream_wrapper_register($protocol, $class); + if (@rewinddir($source) === false) { + $wrapped = fopen($protocol . '://', 'r+', false, $context); + } else { + $wrapped = opendir($protocol . '://', $context); + } + } catch (\BadMethodCallException $e) { + stream_wrapper_unregister($protocol); + throw $e; + } + stream_wrapper_unregister($protocol); + return $wrapped; + } + /** * Load the source from the stream context and return the context options * @@ -107,4 +123,17 @@ abstract class Wrapper implements File { public function stream_close() { return fclose($this->source); } + + public function dir_readdir() { + return readdir($this->source); + } + + public function dir_closedir() { + closedir($this->source); + return true; + } + + public function dir_rewinddir() { + return rewind($this->source); + } } |