diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-05-11 12:05:12 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-05-11 12:05:12 +0200 |
commit | 1a12f14a197f79cbd7dbfddd0b4785623bbf59d3 (patch) | |
tree | 9a3d6d284f089b658612b9e639c81776f7ce2b9a /apps/files_external/3rdparty/icewind/streams | |
parent | 979f4033ca1cd0be7f255f028d4cc637a216440d (diff) | |
download | nextcloud-server-1a12f14a197f79cbd7dbfddd0b4785623bbf59d3.tar.gz nextcloud-server-1a12f14a197f79cbd7dbfddd0b4785623bbf59d3.zip |
Update icewind/streams to 0.7.7, and remove it from explicit deps in files_external
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/files_external/3rdparty/icewind/streams')
8 files changed, 29 insertions, 10 deletions
diff --git a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php index 5d78b5a3db0..bc5e4356cda 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php @@ -58,7 +58,7 @@ class CallbackWrapper extends Wrapper { * @param callable|null $close (optional) * @param callable|null $readDir (optional) * @param callable|null $preClose (optional) - * @return resource|bool + * @return resource|false * */ public static function wrap($source, $read = null, $write = null, $close = null, $readDir = null, $preClose = null) { diff --git a/apps/files_external/3rdparty/icewind/streams/src/CountWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/CountWrapper.php index b3346209aed..d5aee9c9c4b 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/CountWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/CountWrapper.php @@ -55,7 +55,7 @@ class CountWrapper extends Wrapper { * * @param resource $source * @param callable $callback - * @return resource|bool + * @return resource|false * * @throws \BadMethodCallException */ diff --git a/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php b/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php index 80b27e8bab8..6a896c04b08 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php +++ b/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php @@ -46,7 +46,7 @@ class DirectoryFilter extends DirectoryWrapper { /** * @param resource $source * @param callable $filter - * @return resource|bool + * @return resource|false */ public static function wrap($source, callable $filter) { return self::wrapSource($source, [ diff --git a/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php index 7f2f5c291c6..ff47096d2d7 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php @@ -23,7 +23,7 @@ class DirectoryWrapper extends Wrapper implements Directory { } /** - * @return string + * @return string|false */ public function dir_readdir() { return readdir($this->source); diff --git a/apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php index 616c2fe506f..5e0163092e8 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php @@ -41,7 +41,7 @@ abstract class HashWrapper extends Wrapper { * @param resource $source * @param string $hash * @param callable $callback - * @return resource|bool + * @return resource|false * * @throws \BadMethodCallException */ diff --git a/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php b/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php index a3872ddf474..7c6bd515c1e 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php +++ b/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php @@ -92,7 +92,7 @@ class IteratorDirectory extends WrapperHandler implements Directory { * Creates a directory handle from the provided array or iterator * * @param \Iterator | array $source - * @return resource|bool + * @return resource|false * * @throws \BadMethodCallException */ diff --git a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php index 03d0b202571..5b6348afe4f 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php @@ -44,7 +44,7 @@ abstract class Wrapper extends WrapperHandler implements File, Directory { public function stream_seek($offset, $whence = SEEK_SET) { $result = fseek($this->source, $offset, $whence); - return $result == 0 ? true : false; + return $result == 0; } public function stream_tell() { @@ -109,4 +109,23 @@ abstract class Wrapper extends WrapperHandler implements File, Directory { public function dir_rewinddir() { return rewind($this->source); } + + public function getSource() { + return $this->source; + } + + /** + * Retrieves header/metadata from the source stream. + * + * This is equivalent to calling `stream_get_meta_data` on the source stream except nested stream wrappers are handled transparently + * + * @return array + */ + public function getMetaData(): array { + $meta = stream_get_meta_data($this->source); + while (isset($meta['wrapper_data']) && $meta['wrapper_data'] instanceof Wrapper) { + $meta = $meta['wrapper_data']->getMetaData(); + } + return $meta; + } } diff --git a/apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php b/apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php index 52a02feb19f..be408807ed3 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php +++ b/apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php @@ -55,9 +55,9 @@ class WrapperHandler { * @param resource|array $context * @param string|null $protocol deprecated, protocol is now automatically generated * @param string|null $class deprecated, class is now automatically generated - * @return bool|resource + * @return resource|false */ - protected static function wrapSource($source, $context = [], $protocol = null, $class = null) { + protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') { if ($class === null) { $class = static::class; } @@ -72,7 +72,7 @@ class WrapperHandler { if (self::isDirectoryHandle($source)) { return opendir($protocol . '://', $context); } else { - return fopen($protocol . '://', 'r+', false, $context); + return fopen($protocol . '://', $mode, false, $context); } } finally { stream_wrapper_unregister($protocol); |