From f943206634d28bc92f274c0a5eee081ad6b61cff Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 11 May 2020 12:08:34 +0000 Subject: [PATCH 1/3] Bump icewind/streams in /apps/files_external/3rdparty Bumps [icewind/streams](https://github.com/icewind1991/Streams) from 0.7.1 to 0.7.2. - [Release notes](https://github.com/icewind1991/Streams/releases) - [Commits](https://github.com/icewind1991/Streams/compare/v0.7.1...v0.7.2) Signed-off-by: dependabot-preview[bot] --- apps/files_external/3rdparty/composer.json | 2 +- apps/files_external/3rdparty/composer.lock | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/apps/files_external/3rdparty/composer.json b/apps/files_external/3rdparty/composer.json index cb1392bde9fb..4cf86dc88a9d 100644 --- a/apps/files_external/3rdparty/composer.json +++ b/apps/files_external/3rdparty/composer.json @@ -9,7 +9,7 @@ }, "require": { "icewind/smb": "3.1.2", - "icewind/streams": "0.7.1", + "icewind/streams": "0.7.2", "google/apiclient": "2.4.1", "guzzlehttp/guzzle": "^5.3" }, diff --git a/apps/files_external/3rdparty/composer.lock b/apps/files_external/3rdparty/composer.lock index 34b791003a30..ad5ffb2f5982 100644 --- a/apps/files_external/3rdparty/composer.lock +++ b/apps/files_external/3rdparty/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f2efdb04caa9c8973c8e819cd4974453", + "content-hash": "54c65b269e56dbf0455d591a4105cb1b", "packages": [ { "name": "firebase/php-jwt", @@ -528,29 +528,28 @@ }, { "name": "icewind/streams", - "version": "v0.7.1", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/icewind1991/Streams.git", - "reference": "4db3ed6c366e90b958d00e1d4c6360a9b39b2121" + "reference": "77d750ccc654c0eda4a41fedb2dbd71053755790" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/icewind1991/Streams/zipball/4db3ed6c366e90b958d00e1d4c6360a9b39b2121", - "reference": "4db3ed6c366e90b958d00e1d4c6360a9b39b2121", + "url": "https://api.github.com/repos/icewind1991/Streams/zipball/77d750ccc654c0eda4a41fedb2dbd71053755790", + "reference": "77d750ccc654c0eda4a41fedb2dbd71053755790", "shasum": "" }, "require": { - "php": ">=5.3" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^4.8", - "satooshi/php-coveralls": "v1.0.0" + "php-coveralls/php-coveralls": "v2.1.0", + "phpunit/phpunit": "^5.7" }, "type": "library", "autoload": { "psr-4": { - "Icewind\\Streams\\Tests\\": "tests/", "Icewind\\Streams\\": "src/" } }, @@ -565,7 +564,7 @@ } ], "description": "A set of generic stream wrappers", - "time": "2019-02-15T12:57:29+00:00" + "time": "2020-04-08T14:59:33+00:00" }, { "name": "monolog/monolog", From a3010eb78a065844dc1b60785ead6e2b0f3ecc8b Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 11 May 2020 18:04:10 +0545 Subject: [PATCH 2/3] Commit apps/files_external/3rdparty/icewind/streams-0.7.2 code --- .../3rdparty/composer/ClassLoader.php | 4 +- apps/files_external/3rdparty/composer/LICENSE | 69 ++++++++--- .../3rdparty/composer/autoload_classmap.php | 21 +--- .../3rdparty/composer/autoload_psr4.php | 1 - .../3rdparty/composer/autoload_static.php | 26 +--- .../3rdparty/composer/installed.json | 19 ++- .../3rdparty/icewind/streams/.gitignore | 2 + .../3rdparty/icewind/streams/.scrutinizer.yml | 13 ++ .../3rdparty/icewind/streams/.travis.yml | 14 +-- .../3rdparty/icewind/streams/README.md | 2 +- .../3rdparty/icewind/streams/composer.json | 28 +++-- .../icewind/streams/src/CallbackWrapper.php | 36 +++--- .../icewind/streams/src/CountWrapper.php | 15 +-- .../icewind/streams/src/Directory.php | 2 +- .../icewind/streams/src/DirectoryFilter.php | 17 ++- .../icewind/streams/src/DirectoryWrapper.php | 49 +------- .../icewind/streams/src/HashWrapper.php | 80 +++++++++++++ .../icewind/streams/src/IteratorDirectory.php | 38 +++--- .../icewind/streams/src/NullWrapper.php | 18 +-- .../3rdparty/icewind/streams/src/Path.php | 4 +- .../icewind/streams/src/PathWrapper.php | 6 +- .../icewind/streams/src/ReadHashWrapper.php | 40 +++++++ .../icewind/streams/src/RetryWrapper.php | 22 +--- .../icewind/streams/src/SeekableWrapper.php | 23 ++-- .../src/{UrlCallBack.php => UrlCallback.php} | 34 +++--- .../3rdparty/icewind/streams/src/Wrapper.php | 52 ++------ .../icewind/streams/src/WrapperHandler.php | 112 ++++++++++++++++++ .../icewind/streams/src/WriteHashWrapper.php | 37 ++++++ 28 files changed, 472 insertions(+), 312 deletions(-) create mode 100644 apps/files_external/3rdparty/icewind/streams/.scrutinizer.yml create mode 100644 apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php create mode 100644 apps/files_external/3rdparty/icewind/streams/src/ReadHashWrapper.php rename apps/files_external/3rdparty/icewind/streams/src/{UrlCallBack.php => UrlCallback.php} (79%) create mode 100644 apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php create mode 100644 apps/files_external/3rdparty/icewind/streams/src/WriteHashWrapper.php diff --git a/apps/files_external/3rdparty/composer/ClassLoader.php b/apps/files_external/3rdparty/composer/ClassLoader.php index fce8549f0781..dc02dfb114fb 100644 --- a/apps/files_external/3rdparty/composer/ClassLoader.php +++ b/apps/files_external/3rdparty/composer/ClassLoader.php @@ -279,7 +279,7 @@ public function isClassMapAuthoritative() */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; } /** @@ -377,7 +377,7 @@ private function findFileWithExtension($class, $ext) $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; + $search = $subPath.'\\'; if (isset($this->prefixDirsPsr4[$search])) { $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { diff --git a/apps/files_external/3rdparty/composer/LICENSE b/apps/files_external/3rdparty/composer/LICENSE index f27399a042d9..f0157a6ed025 100644 --- a/apps/files_external/3rdparty/composer/LICENSE +++ b/apps/files_external/3rdparty/composer/LICENSE @@ -1,21 +1,56 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Composer +Upstream-Contact: Jordi Boggiano +Source: https://github.com/composer/composer -Copyright (c) Nils Adermann, Jordi Boggiano +Files: * +Copyright: 2016, Nils Adermann + 2016, Jordi Boggiano +License: Expat -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: +Files: src/Composer/Util/TlsHelper.php +Copyright: 2016, Nils Adermann + 2016, Jordi Boggiano + 2013, Evan Coury +License: Expat and BSD-2-Clause -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +License: BSD-2-Clause + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + . + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is furnished + to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/apps/files_external/3rdparty/composer/autoload_classmap.php b/apps/files_external/3rdparty/composer/autoload_classmap.php index 2f853509a62e..5080c4529070 100644 --- a/apps/files_external/3rdparty/composer/autoload_classmap.php +++ b/apps/files_external/3rdparty/composer/autoload_classmap.php @@ -11588,30 +11588,19 @@ 'Icewind\\Streams\\DirectoryFilter' => $vendorDir . '/icewind/streams/src/DirectoryFilter.php', 'Icewind\\Streams\\DirectoryWrapper' => $vendorDir . '/icewind/streams/src/DirectoryWrapper.php', 'Icewind\\Streams\\File' => $vendorDir . '/icewind/streams/src/File.php', + 'Icewind\\Streams\\HashWrapper' => $vendorDir . '/icewind/streams/src/HashWrapper.php', 'Icewind\\Streams\\IteratorDirectory' => $vendorDir . '/icewind/streams/src/IteratorDirectory.php', 'Icewind\\Streams\\NullWrapper' => $vendorDir . '/icewind/streams/src/NullWrapper.php', 'Icewind\\Streams\\Path' => $vendorDir . '/icewind/streams/src/Path.php', 'Icewind\\Streams\\PathWrapper' => $vendorDir . '/icewind/streams/src/PathWrapper.php', + 'Icewind\\Streams\\ReadHashWrapper' => $vendorDir . '/icewind/streams/src/ReadHashWrapper.php', 'Icewind\\Streams\\RetryWrapper' => $vendorDir . '/icewind/streams/src/RetryWrapper.php', 'Icewind\\Streams\\SeekableWrapper' => $vendorDir . '/icewind/streams/src/SeekableWrapper.php', - 'Icewind\\Streams\\Tests\\CallbackWrapperTest' => $vendorDir . '/icewind/streams/tests/CallbackWrapperTest.php', - 'Icewind\\Streams\\Tests\\CountWrapperTest' => $vendorDir . '/icewind/streams/tests/CountWrapperTest.php', - 'Icewind\\Streams\\Tests\\DirectoryFilter' => $vendorDir . '/icewind/streams/tests/DirectoryFilter.php', - 'Icewind\\Streams\\Tests\\DirectoryWrapper' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php', - 'Icewind\\Streams\\Tests\\DirectoryWrapperDummy' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php', - 'Icewind\\Streams\\Tests\\DirectoryWrapperNull' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php', - 'Icewind\\Streams\\Tests\\FailWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\IteratorDirectory' => $vendorDir . '/icewind/streams/tests/IteratorDirectory.php', - 'Icewind\\Streams\\Tests\\NullWrapperTest' => $vendorDir . '/icewind/streams/tests/NullWrapperTest.php', - 'Icewind\\Streams\\Tests\\PartialWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\PathWrapper' => $vendorDir . '/icewind/streams/tests/PathWrapper.php', - 'Icewind\\Streams\\Tests\\RetryWrapperTest' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\SeekableWrapper' => $vendorDir . '/icewind/streams/tests/SeekableWrapper.php', - 'Icewind\\Streams\\Tests\\UrlCallBack' => $vendorDir . '/icewind/streams/tests/UrlCallBack.php', - 'Icewind\\Streams\\Tests\\WrapperTest' => $vendorDir . '/icewind/streams/tests/WrapperTest.php', 'Icewind\\Streams\\Url' => $vendorDir . '/icewind/streams/src/Url.php', - 'Icewind\\Streams\\UrlCallback' => $vendorDir . '/icewind/streams/src/UrlCallBack.php', + 'Icewind\\Streams\\UrlCallback' => $vendorDir . '/icewind/streams/src/UrlCallback.php', 'Icewind\\Streams\\Wrapper' => $vendorDir . '/icewind/streams/src/Wrapper.php', + 'Icewind\\Streams\\WrapperHandler' => $vendorDir . '/icewind/streams/src/WrapperHandler.php', + 'Icewind\\Streams\\WriteHashWrapper' => $vendorDir . '/icewind/streams/src/WriteHashWrapper.php', 'Monolog\\ErrorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/ErrorHandler.php', 'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php', 'Monolog\\Formatter\\ElasticaFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php', diff --git a/apps/files_external/3rdparty/composer/autoload_psr4.php b/apps/files_external/3rdparty/composer/autoload_psr4.php index c4f93d6e08e9..bdbb82f9583d 100644 --- a/apps/files_external/3rdparty/composer/autoload_psr4.php +++ b/apps/files_external/3rdparty/composer/autoload_psr4.php @@ -12,7 +12,6 @@ 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), - 'Icewind\\Streams\\Tests\\' => array($vendorDir . '/icewind/streams/tests'), 'Icewind\\Streams\\' => array($vendorDir . '/icewind/streams/src'), 'Icewind\\SMB\\Test\\' => array($vendorDir . '/icewind/smb/tests'), 'Icewind\\SMB\\' => array($vendorDir . '/icewind/smb/src'), diff --git a/apps/files_external/3rdparty/composer/autoload_static.php b/apps/files_external/3rdparty/composer/autoload_static.php index b231c3fa1c3d..200ac55ed97b 100644 --- a/apps/files_external/3rdparty/composer/autoload_static.php +++ b/apps/files_external/3rdparty/composer/autoload_static.php @@ -36,7 +36,6 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3 ), 'I' => array ( - 'Icewind\\Streams\\Tests\\' => 22, 'Icewind\\Streams\\' => 16, 'Icewind\\SMB\\Test\\' => 17, 'Icewind\\SMB\\' => 12, @@ -81,10 +80,6 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3 array ( 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', ), - 'Icewind\\Streams\\Tests\\' => - array ( - 0 => __DIR__ . '/..' . '/icewind/streams/tests', - ), 'Icewind\\Streams\\' => array ( 0 => __DIR__ . '/..' . '/icewind/streams/src', @@ -11724,30 +11719,19 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3 'Icewind\\Streams\\DirectoryFilter' => __DIR__ . '/..' . '/icewind/streams/src/DirectoryFilter.php', 'Icewind\\Streams\\DirectoryWrapper' => __DIR__ . '/..' . '/icewind/streams/src/DirectoryWrapper.php', 'Icewind\\Streams\\File' => __DIR__ . '/..' . '/icewind/streams/src/File.php', + 'Icewind\\Streams\\HashWrapper' => __DIR__ . '/..' . '/icewind/streams/src/HashWrapper.php', 'Icewind\\Streams\\IteratorDirectory' => __DIR__ . '/..' . '/icewind/streams/src/IteratorDirectory.php', 'Icewind\\Streams\\NullWrapper' => __DIR__ . '/..' . '/icewind/streams/src/NullWrapper.php', 'Icewind\\Streams\\Path' => __DIR__ . '/..' . '/icewind/streams/src/Path.php', 'Icewind\\Streams\\PathWrapper' => __DIR__ . '/..' . '/icewind/streams/src/PathWrapper.php', + 'Icewind\\Streams\\ReadHashWrapper' => __DIR__ . '/..' . '/icewind/streams/src/ReadHashWrapper.php', 'Icewind\\Streams\\RetryWrapper' => __DIR__ . '/..' . '/icewind/streams/src/RetryWrapper.php', 'Icewind\\Streams\\SeekableWrapper' => __DIR__ . '/..' . '/icewind/streams/src/SeekableWrapper.php', - 'Icewind\\Streams\\Tests\\CallbackWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/CallbackWrapperTest.php', - 'Icewind\\Streams\\Tests\\CountWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/CountWrapperTest.php', - 'Icewind\\Streams\\Tests\\DirectoryFilter' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryFilter.php', - 'Icewind\\Streams\\Tests\\DirectoryWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php', - 'Icewind\\Streams\\Tests\\DirectoryWrapperDummy' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php', - 'Icewind\\Streams\\Tests\\DirectoryWrapperNull' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php', - 'Icewind\\Streams\\Tests\\FailWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\IteratorDirectory' => __DIR__ . '/..' . '/icewind/streams/tests/IteratorDirectory.php', - 'Icewind\\Streams\\Tests\\NullWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/NullWrapperTest.php', - 'Icewind\\Streams\\Tests\\PartialWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\PathWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/PathWrapper.php', - 'Icewind\\Streams\\Tests\\RetryWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\SeekableWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/SeekableWrapper.php', - 'Icewind\\Streams\\Tests\\UrlCallBack' => __DIR__ . '/..' . '/icewind/streams/tests/UrlCallBack.php', - 'Icewind\\Streams\\Tests\\WrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/WrapperTest.php', 'Icewind\\Streams\\Url' => __DIR__ . '/..' . '/icewind/streams/src/Url.php', - 'Icewind\\Streams\\UrlCallback' => __DIR__ . '/..' . '/icewind/streams/src/UrlCallBack.php', + 'Icewind\\Streams\\UrlCallback' => __DIR__ . '/..' . '/icewind/streams/src/UrlCallback.php', 'Icewind\\Streams\\Wrapper' => __DIR__ . '/..' . '/icewind/streams/src/Wrapper.php', + 'Icewind\\Streams\\WrapperHandler' => __DIR__ . '/..' . '/icewind/streams/src/WrapperHandler.php', + 'Icewind\\Streams\\WriteHashWrapper' => __DIR__ . '/..' . '/icewind/streams/src/WriteHashWrapper.php', 'Monolog\\ErrorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ErrorHandler.php', 'Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php', 'Monolog\\Formatter\\ElasticaFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php', diff --git a/apps/files_external/3rdparty/composer/installed.json b/apps/files_external/3rdparty/composer/installed.json index a1b6d717e98d..5043d1bc32ad 100644 --- a/apps/files_external/3rdparty/composer/installed.json +++ b/apps/files_external/3rdparty/composer/installed.json @@ -541,32 +541,31 @@ }, { "name": "icewind/streams", - "version": "v0.7.1", - "version_normalized": "0.7.1.0", + "version": "v0.7.2", + "version_normalized": "0.7.2.0", "source": { "type": "git", "url": "https://github.com/icewind1991/Streams.git", - "reference": "4db3ed6c366e90b958d00e1d4c6360a9b39b2121" + "reference": "77d750ccc654c0eda4a41fedb2dbd71053755790" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/icewind1991/Streams/zipball/4db3ed6c366e90b958d00e1d4c6360a9b39b2121", - "reference": "4db3ed6c366e90b958d00e1d4c6360a9b39b2121", + "url": "https://api.github.com/repos/icewind1991/Streams/zipball/77d750ccc654c0eda4a41fedb2dbd71053755790", + "reference": "77d750ccc654c0eda4a41fedb2dbd71053755790", "shasum": "" }, "require": { - "php": ">=5.3" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^4.8", - "satooshi/php-coveralls": "v1.0.0" + "php-coveralls/php-coveralls": "v2.1.0", + "phpunit/phpunit": "^5.7" }, - "time": "2019-02-15T12:57:29+00:00", + "time": "2020-04-08T14:59:33+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { - "Icewind\\Streams\\Tests\\": "tests/", "Icewind\\Streams\\": "src/" } }, diff --git a/apps/files_external/3rdparty/icewind/streams/.gitignore b/apps/files_external/3rdparty/icewind/streams/.gitignore index 4f389129e2d9..e2a9a5109fa0 100644 --- a/apps/files_external/3rdparty/icewind/streams/.gitignore +++ b/apps/files_external/3rdparty/icewind/streams/.gitignore @@ -1,3 +1,5 @@ .idea vendor composer.lock +build +example.php diff --git a/apps/files_external/3rdparty/icewind/streams/.scrutinizer.yml b/apps/files_external/3rdparty/icewind/streams/.scrutinizer.yml new file mode 100644 index 000000000000..0c7c78622a5f --- /dev/null +++ b/apps/files_external/3rdparty/icewind/streams/.scrutinizer.yml @@ -0,0 +1,13 @@ +build: + nodes: + analysis: + tests: + override: + - php-scrutinizer-run +tools: + php_sim: true + php_pdepend: true + php_analyzer: true +filter: + excluded_paths: + - 'tests/*' diff --git a/apps/files_external/3rdparty/icewind/streams/.travis.yml b/apps/files_external/3rdparty/icewind/streams/.travis.yml index 68efcd2c7442..870956fc6711 100644 --- a/apps/files_external/3rdparty/icewind/streams/.travis.yml +++ b/apps/files_external/3rdparty/icewind/streams/.travis.yml @@ -1,24 +1,18 @@ language: php php: - - 5.4 - - 5.5 - 5.6 - 7.0 - 7.1 - 7.2 - -env: - global: - - CURRENT_DIR=`pwd` + - 7.3 + - 7.4 install: - composer install --dev --no-interaction script: - mkdir -p build/logs - - cd tests - - phpunit --coverage-clover ../build/logs/clover.xml --configuration phpunit.xml + - vendor/bin/phpunit --coverage-clover build/logs/clover.xml --configuration tests/phpunit.xml after_script: - - cd $CURRENT_DIR - - php vendor/bin/coveralls -v + - vendor/bin/php-coveralls -v diff --git a/apps/files_external/3rdparty/icewind/streams/README.md b/apps/files_external/3rdparty/icewind/streams/README.md index 88ab2dd92a33..e3b4bbfedf14 100644 --- a/apps/files_external/3rdparty/icewind/streams/README.md +++ b/apps/files_external/3rdparty/icewind/streams/README.md @@ -14,7 +14,7 @@ it wraps an existing stream and can thus be used for any stream in php The callbacks are passed in the stream context along with the source stream and can be any valid [php callable](http://php.net/manual/en/language.types.callable.php) -###Example### +### Example ### ```php =5.3" + "require": { + "php": ">=5.6" }, - "require-dev" : { - "satooshi/php-coveralls": "v1.0.0", - "phpunit/phpunit": "^4.8" + "require-dev": { + "php-coveralls/php-coveralls": "v2.1.0", + "phpunit/phpunit": "^5.7" }, - "autoload" : { + "autoload": { "psr-4": { - "Icewind\\Streams\\Tests\\": "tests/", "Icewind\\Streams\\": "src/" } + }, + "autoload-dev": { + "psr-4": { + "Icewind\\Streams\\Tests\\": "tests/" + } } } diff --git a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php index 67f9110d1007..be62e3f66910 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php @@ -53,30 +53,28 @@ class CallbackWrapper extends Wrapper { * Wraps a stream with the provided callbacks * * @param resource $source - * @param callable $read (optional) - * @param callable $write (optional) - * @param callable $close (optional) - * @param callable $readDir (optional) - * @return resource + * @param callable|null $read (optional) + * @param callable|null $write (optional) + * @param callable|null $close (optional) + * @param callable|null $readDir (optional) + * @param callable|null $preClose (optional) + * @return resource|bool * - * @throws \BadMethodCallException */ public static function wrap($source, $read = null, $write = null, $close = null, $readDir = null, $preClose = null) { - $context = stream_context_create(array( - 'callback' => array( - 'source' => $source, - 'read' => $read, - 'write' => $write, - 'close' => $close, - 'readDir' => $readDir, - 'preClose' => $preClose, - ) - )); - return Wrapper::wrapSource($source, $context, 'callback', '\Icewind\Streams\CallbackWrapper'); + $context = [ + 'source' => $source, + 'read' => $read, + 'write' => $write, + 'close' => $close, + 'readDir' => $readDir, + 'preClose' => $preClose, + ]; + return self::wrapSource($source, $context); } protected function open() { - $context = $this->loadContext('callback'); + $context = $this->loadContext(); $this->readCallback = $context['read']; $this->writeCallback = $context['write']; @@ -112,7 +110,7 @@ public function stream_write($data) { public function stream_close() { if (is_callable($this->preCloseCallback)) { - call_user_func($this->preCloseCallback, $this->loadContext('callback')['source']); + call_user_func($this->preCloseCallback, $this->source); // prevent further calls by potential PHP 7 GC ghosts $this->preCloseCallback = null; } diff --git a/apps/files_external/3rdparty/icewind/streams/src/CountWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/CountWrapper.php index 8b86ab9187cc..d02434012293 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 + * @return resource|bool * * @throws \BadMethodCallException */ @@ -63,17 +63,14 @@ public static function wrap($source, $callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Invalid or missing callback'); } - $context = stream_context_create(array( - 'count' => array( - 'source' => $source, - 'callback' => $callback - ) - )); - return Wrapper::wrapSource($source, $context, 'callback', '\Icewind\Streams\CountWrapper'); + return self::wrapSource($source, [ + 'source' => $source, + 'callback' => $callback + ]); } protected function open() { - $context = $this->loadContext('count'); + $context = $this->loadContext(); $this->callback = $context['callback']; return true; } diff --git a/apps/files_external/3rdparty/icewind/streams/src/Directory.php b/apps/files_external/3rdparty/icewind/streams/src/Directory.php index c80a878386b5..912be76acfab 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/Directory.php +++ b/apps/files_external/3rdparty/icewind/streams/src/Directory.php @@ -19,7 +19,7 @@ interface Directory { public function dir_opendir($path, $options); /** - * @return string + * @return string|bool */ public function dir_readdir(); diff --git a/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php b/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php index 4b8696990007..80b27e8bab85 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php +++ b/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php @@ -25,7 +25,7 @@ class DirectoryFilter extends DirectoryWrapper { * @return bool */ public function dir_opendir($path, $options) { - $context = $this->loadContext('filter'); + $context = $this->loadContext(); $this->filter = $context['filter']; return true; } @@ -36,7 +36,7 @@ public function dir_opendir($path, $options) { public function dir_readdir() { $file = readdir($this->source); $filter = $this->filter; - // keep reading untill we have an accepted entry or we're at the end of the folder + // keep reading until we have an accepted entry or we're at the end of the folder while ($file !== false && $filter($file) === false) { $file = readdir($this->source); } @@ -46,15 +46,12 @@ public function dir_readdir() { /** * @param resource $source * @param callable $filter - * @return resource + * @return resource|bool */ public static function wrap($source, callable $filter) { - $options = array( - 'filter' => array( - 'source' => $source, - 'filter' => $filter - ) - ); - return self::wrapWithOptions($options, '\Icewind\Streams\DirectoryFilter'); + return self::wrapSource($source, [ + 'source' => $source, + 'filter' => $filter + ]); } } diff --git a/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php index 63e4805a807c..7f2f5c291c6a 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php @@ -7,37 +7,9 @@ namespace Icewind\Streams; -class DirectoryWrapper implements Directory { - /** - * @var resource - */ - public $context; - - /** - * @var resource - */ - protected $source; - - /** - * Load the source from the stream context and return the context options - * - * @param string $name - * @return array - * @throws \Exception - */ - protected function loadContext($name) { - $context = stream_context_get_options($this->context); - if (isset($context[$name])) { - $context = $context[$name]; - } else { - throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); - } - if (isset($context['source']) and is_resource($context['source'])) { - $this->source = $context['source']; - } else { - throw new \BadMethodCallException('Invalid context, source not set'); - } - return $context; +class DirectoryWrapper extends Wrapper implements Directory { + public function stream_open($path, $mode, $options, &$opened_path) { + return false; } /** @@ -46,7 +18,7 @@ protected function loadContext($name) { * @return bool */ public function dir_opendir($path, $options) { - $this->loadContext('dir'); + $this->loadContext(); return true; } @@ -72,17 +44,4 @@ public function dir_rewinddir() { rewinddir($this->source); return true; } - - /** - * @param array $options the options for the context to wrap the stream with - * @param string $class - * @return resource - */ - protected static function wrapWithOptions($options, $class) { - $context = stream_context_create($options); - stream_wrapper_register('dirwrapper', $class); - $wrapped = opendir('dirwrapper://', $context); - stream_wrapper_unregister('dirwrapper'); - return $wrapped; - } } diff --git a/apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php new file mode 100644 index 000000000000..0628d8bc72be --- /dev/null +++ b/apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php @@ -0,0 +1,80 @@ + + * + * @author Roeland Jago Douma + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace Icewind\Streams; + + +abstract class HashWrapper extends Wrapper { + + /** + * @var callable + */ + private $callback; + + /** + * @var resource + */ + private $hashContext; + + /** + * Wraps a stream to make it seekable + * + * @param resource $source + * @param string $hash + * @param callable $callback + * @return resource|bool + * + * @throws \BadMethodCallException + */ + public static function wrap($source, $hash, $callback) { + $context = [ + 'hash' => $hash, + 'callback' => $callback, + ]; + return self::wrapSource($source, $context); + } + + public function dir_opendir($path, $options) { + return false; + } + + public function stream_open($path, $mode, $options, &$opened_path) { + $context = $this->loadContext(); + $this->callback = $context['callback']; + $this->hashContext = hash_init($context['hash']); + return true; + } + + protected function updateHash($data) { + hash_update($this->hashContext, $data); + } + + public function stream_close() { + $hash = hash_final($this->hashContext); + if ($this->hashContext !== false && is_callable($this->callback)) { + call_user_func($this->callback, $hash); + } + return parent::stream_close(); + } + +} \ No newline at end of file diff --git a/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php b/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php index 6dfa42a8b684..057c1992f9c5 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php +++ b/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php @@ -20,7 +20,7 @@ * * Either 'array' or 'iterator' need to be set, if both are set, 'iterator' takes preference */ -class IteratorDirectory implements Directory { +class IteratorDirectory extends WrapperHandler implements Directory { /** * @var resource */ @@ -36,15 +36,10 @@ class IteratorDirectory implements Directory { * * @param string $name * @return array - * @throws \Exception + * @throws \BadMethodCallException */ - protected function loadContext($name) { - $context = stream_context_get_options($this->context); - if (isset($context[$name])) { - $context = $context[$name]; - } else { - throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); - } + protected function loadContext($name = null) { + $context = parent::loadContext($name); if (isset($context['iterator'])) { $this->iterator = $context['iterator']; } else if (isset($context['array'])) { @@ -61,12 +56,12 @@ protected function loadContext($name) { * @return bool */ public function dir_opendir($path, $options) { - $this->loadContext('dir'); + $this->loadContext(); return true; } /** - * @return string + * @return string|bool */ public function dir_readdir() { if ($this->iterator->valid()) { @@ -97,27 +92,22 @@ public function dir_rewinddir() { * Creates a directory handle from the provided array or iterator * * @param \Iterator | array $source - * @return resource + * @return resource|bool * * @throws \BadMethodCallException */ public static function wrap($source) { if ($source instanceof \Iterator) { - $context = stream_context_create(array( - 'dir' => array( - 'iterator' => $source) - )); + $options = [ + 'iterator' => $source + ]; } else if (is_array($source)) { - $context = stream_context_create(array( - 'dir' => array( - 'array' => $source) - )); + $options = [ + 'array' => $source + ]; } else { throw new \BadMethodCallException('$source should be an Iterator or array'); } - stream_wrapper_register('iterator', '\Icewind\Streams\IteratorDirectory'); - $wrapped = opendir('iterator://', $context); - stream_wrapper_unregister('iterator'); - return $wrapped; + return self::wrapSource(self::NO_SOURCE_DIR, $options); } } diff --git a/apps/files_external/3rdparty/icewind/streams/src/NullWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/NullWrapper.php index b6c71d98fc4a..92aef2c7a2d2 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/NullWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/NullWrapper.php @@ -11,29 +11,17 @@ * Stream wrapper that does nothing, used for tests */ class NullWrapper extends Wrapper { - /** - * Wraps a stream with the provided callbacks - * - * @param resource $source - * @return resource - * - * @throws \BadMethodCallException - */ public static function wrap($source) { - $context = stream_context_create(array( - 'null' => array( - 'source' => $source) - )); - return Wrapper::wrapSource($source, $context, 'null', '\Icewind\Streams\NullWrapper'); + return self::wrapSource($source); } public function stream_open($path, $mode, $options, &$opened_path) { - $this->loadContext('null'); + $this->loadContext(); return true; } public function dir_opendir($path, $options) { - $this->loadContext('null'); + $this->loadContext(); return true; } } diff --git a/apps/files_external/3rdparty/icewind/streams/src/Path.php b/apps/files_external/3rdparty/icewind/streams/src/Path.php index bef9fd5f6162..42d74a2ac1a2 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/Path.php +++ b/apps/files_external/3rdparty/icewind/streams/src/Path.php @@ -38,7 +38,7 @@ class Path { * @param string $class * @param array $contextOptions */ - public function __construct($class, $contextOptions = array()) { + public function __construct($class, $contextOptions = []) { $this->class = $class; $this->contextOptions = $contextOptions; } @@ -75,7 +75,7 @@ protected function unregister() { */ protected function appendDefaultContent($values) { if (!is_array(current($values))) { - $values = array($this->getProtocol() => $values); + $values = [$this->getProtocol() => $values]; } $context = stream_context_get_default(); $defaults = stream_context_get_options($context); diff --git a/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php index 88af7e17b336..d9f3014c3812 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php @@ -16,10 +16,8 @@ class PathWrapper extends NullWrapper { * @return Path|string */ public static function getPath($source) { - return new Path(__CLASS__, [ - 'null' => [ - 'source' => $source - ] + return new Path(NullWrapper::class, [ + NullWrapper::getProtocol() => ['source' => $source] ]); } } diff --git a/apps/files_external/3rdparty/icewind/streams/src/ReadHashWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/ReadHashWrapper.php new file mode 100644 index 000000000000..16cf006ccf51 --- /dev/null +++ b/apps/files_external/3rdparty/icewind/streams/src/ReadHashWrapper.php @@ -0,0 +1,40 @@ + + * + * @author Roeland Jago Douma + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace Icewind\Streams; + +/** + * Wrapper that calculates the hash on the stream on read + * + * The stream and hash should be passed in when wrapping the stream. + * On close the callback will be called with the calculated checksum. + * + * For supported hashes see: http://php.net/manual/en/function.hash-algos.php + */ +class ReadHashWrapper extends HashWrapper { + public function stream_read($count) { + $data = parent::stream_read($count); + $this->updateHash($data); + return $data; + } +} diff --git a/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php index 8238f19f7c93..d4727aa96cd4 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php @@ -11,25 +11,8 @@ * Wrapper that retries reads/writes to remote streams that dont deliver/recieve all requested data at once */ class RetryWrapper extends Wrapper { - - /** - * Wraps a stream with the provided callbacks - * - * @param resource $source - * @return resource - */ public static function wrap($source) { - $context = stream_context_create(array( - 'retry' => array( - 'source' => $source - ) - )); - return Wrapper::wrapSource($source, $context, 'retry', '\Icewind\Streams\RetryWrapper'); - } - - protected function open() { - $this->loadContext('retry'); - return true; + return self::wrapSource($source); } public function dir_opendir($path, $options) { @@ -37,7 +20,8 @@ public function dir_opendir($path, $options) { } public function stream_open($path, $mode, $options, &$opened_path) { - return $this->open(); + $this->loadContext(); + return true; } public function stream_read($count) { diff --git a/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php index d41fd73ec9c2..f7abbc514251 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php @@ -25,21 +25,8 @@ class SeekableWrapper extends Wrapper { */ protected $cache; - /** - * Wraps a stream to make it seekable - * - * @param resource $source - * @return resource - * - * @throws \BadMethodCallException - */ public static function wrap($source) { - $context = stream_context_create(array( - 'callback' => array( - 'source' => $source - ) - )); - return Wrapper::wrapSource($source, $context, 'callback', '\Icewind\Streams\SeekableWrapper'); + return self::wrapSource($source); } public function dir_opendir($path, $options) { @@ -47,8 +34,12 @@ public function dir_opendir($path, $options) { } public function stream_open($path, $mode, $options, &$opened_path) { - $this->loadContext('callback'); - $this->cache = fopen('php://temp', 'w+'); + $this->loadContext(); + $cache = fopen('php://temp', 'w+'); + if ($cache === false) { + return false; + } + $this->cache = $cache; return true; } diff --git a/apps/files_external/3rdparty/icewind/streams/src/UrlCallBack.php b/apps/files_external/3rdparty/icewind/streams/src/UrlCallback.php similarity index 79% rename from apps/files_external/3rdparty/icewind/streams/src/UrlCallBack.php rename to apps/files_external/3rdparty/icewind/streams/src/UrlCallback.php index 580bfc6ba221..02dca15f95ca 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/UrlCallBack.php +++ b/apps/files_external/3rdparty/icewind/streams/src/UrlCallback.php @@ -47,11 +47,10 @@ class UrlCallback extends Wrapper implements Url { * @return \Icewind\Streams\Path * * @throws \BadMethodCallException - * @throws \Exception */ public static function wrap($source, $fopen = null, $opendir = null, $mkdir = null, $rename = null, $rmdir = null, $unlink = null, $stat = null) { - $options = array( + return new Path(static::class, [ 'source' => $source, 'fopen' => $fopen, 'opendir' => $opendir, @@ -60,11 +59,10 @@ public static function wrap($source, $fopen = null, $opendir = null, $mkdir = nu 'rmdir' => $rmdir, 'unlink' => $unlink, 'stat' => $stat - ); - return new Path('\Icewind\Streams\UrlCallBack', $options); + ]); } - protected function loadContext($url) { + protected function loadUrlContext($url) { list($protocol) = explode('://', $url); $options = stream_context_get_options($this->context); return $options[$protocol]; @@ -77,40 +75,48 @@ protected function callCallBack($context, $callback) { } public function stream_open($path, $mode, $options, &$opened_path) { - $context = $this->loadContext($path); + $context = $this->loadUrlContext($path); $this->callCallBack($context, 'fopen'); - $this->setSourceStream(fopen($context['source'], $mode)); + $source = fopen($context['source'], $mode); + if ($source === false) { + return false; + } + $this->setSourceStream($source); return true; } public function dir_opendir($path, $options) { - $context = $this->loadContext($path); + $context = $this->loadUrlContext($path); $this->callCallBack($context, 'opendir'); - $this->setSourceStream(opendir($context['source'])); + $source = opendir($context['source']); + if ($source === false) { + return false; + } + $this->setSourceStream($source); return true; } public function mkdir($path, $mode, $options) { - $context = $this->loadContext($path); + $context = $this->loadUrlContext($path); $this->callCallBack($context, 'mkdir'); - return mkdir($context['source'], $mode, $options & STREAM_MKDIR_RECURSIVE); + return mkdir($context['source'], $mode, ($options & STREAM_MKDIR_RECURSIVE) > 0); } public function rmdir($path, $options) { - $context = $this->loadContext($path); + $context = $this->loadUrlContext($path); $this->callCallBack($context, 'rmdir'); return rmdir($context['source']); } public function rename($source, $target) { - $context = $this->loadContext($source); + $context = $this->loadUrlContext($source); $this->callCallBack($context, 'rename'); list(, $target) = explode('://', $target); return rename($context['source'], $target); } public function unlink($path) { - $context = $this->loadContext($path); + $context = $this->loadUrlContext($path); $this->callCallBack($context, 'unlink'); return unlink($context['source']); } diff --git a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php index babd2c1a0b3f..abadab4dc4b7 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 @@ * * This wrapper itself doesn't implement any functionality but is just a base class for other wrappers to extend */ -abstract class Wrapper implements File, Directory { +abstract class Wrapper extends WrapperHandler implements File, Directory { /** * @var resource */ @@ -25,44 +25,15 @@ abstract class Wrapper implements File, Directory { */ protected $source; - protected static function wrapSource($source, $context, $protocol, $class) { - if (!is_resource($source)) { - throw new \BadMethodCallException(); - } - try { - stream_wrapper_register($protocol, $class); - if (self::isDirectoryHandle($source)) { - $wrapped = opendir($protocol . '://', $context); - } else { - $wrapped = fopen($protocol . '://', 'r+', false, $context); - } - } catch (\BadMethodCallException $e) { - stream_wrapper_unregister($protocol); - throw $e; - } - stream_wrapper_unregister($protocol); - return $wrapped; - } - - protected static function isDirectoryHandle($resource) { - $meta = stream_get_meta_data($resource); - return $meta['stream_type'] == 'dir'; - } - /** - * Load the source from the stream context and return the context options - * - * @param string $name - * @return array - * @throws \Exception + * @param resource $source */ - protected function loadContext($name) { - $context = stream_context_get_options($this->context); - if (isset($context[$name])) { - $context = $context[$name]; - } else { - throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); - } + protected function setSourceStream($source) { + $this->source = $source; + } + + protected function loadContext($name = null) { + $context = parent::loadContext($name); if (isset($context['source']) and is_resource($context['source'])) { $this->setSourceStream($context['source']); } else { @@ -71,13 +42,6 @@ protected function loadContext($name) { return $context; } - /** - * @param resource $source - */ - protected function setSourceStream($source) { - $this->source = $source; - } - public function stream_seek($offset, $whence = SEEK_SET) { $result = fseek($this->source, $offset, $whence); return $result == 0 ? true : false; diff --git a/apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php b/apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php new file mode 100644 index 000000000000..72dc71485515 --- /dev/null +++ b/apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php @@ -0,0 +1,112 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace Icewind\Streams; + + +class WrapperHandler { + const NO_SOURCE_DIR = 1; + + /** + * get the protocol name that is generated for the class + * @param string|null $class + * @return string + */ + public static function getProtocol($class = null) { + if ($class === null) { + $class = static::class; + } + + $parts = explode('\\', $class); + return strtolower(array_pop($parts)); + } + + private static function buildContext($protocol, $context, $source) { + if (is_array($context)) { + $context['source'] = $source; + return stream_context_create([$protocol => $context]); + } else { + return $context; + } + } + + /** + * @param resource|int $source + * @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 + */ + protected static function wrapSource($source, $context = [], $protocol = null, $class = null) { + if ($class === null) { + $class = static::class; + } + + if ($protocol === null) { + $protocol = self::getProtocol($class); + } + + $context = self::buildContext($protocol, $context, $source); + try { + stream_wrapper_register($protocol, $class); + if (self::isDirectoryHandle($source)) { + return opendir($protocol . '://', $context); + } else { + return fopen($protocol . '://', 'r+', false, $context); + } + } finally { + stream_wrapper_unregister($protocol); + } + } + + protected static function isDirectoryHandle($resource) { + if ($resource === self::NO_SOURCE_DIR) { + return true; + } + if (!is_resource($resource)) { + throw new \BadMethodCallException('Invalid stream source'); + } + $meta = stream_get_meta_data($resource); + return $meta['stream_type'] === 'dir' || $meta['stream_type'] === 'user-space-dir'; + } + + /** + * Load the source from the stream context and return the context options + * + * @param string|null $name if not set, the generated protocol name is used + * @return array + * @throws \BadMethodCallException + */ + protected function loadContext($name = null) { + if ($name === null) { + $parts = explode('\\', static::class); + $name = strtolower(array_pop($parts)); + } + + $context = stream_context_get_options($this->context); + if (isset($context[$name])) { + $context = $context[$name]; + } else { + throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); + } + return $context; + } +} diff --git a/apps/files_external/3rdparty/icewind/streams/src/WriteHashWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/WriteHashWrapper.php new file mode 100644 index 000000000000..854845ad19dd --- /dev/null +++ b/apps/files_external/3rdparty/icewind/streams/src/WriteHashWrapper.php @@ -0,0 +1,37 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace Icewind\Streams; + +/** + * Wrapper that calculates the hash on the stream on write + * + * The stream and hash should be passed in when wrapping the stream. + * On close the callback will be called with the calculated checksum. + * + * For supported hashes see: http://php.net/manual/en/function.hash-algos.php + */ +class WriteHashWrapper extends HashWrapper { + public function stream_write($data) { + $this->updateHash($data); + return parent::stream_write($data); + } +} \ No newline at end of file From 447d1e74fc0001ac41f38483671a488bc2d4ec36 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 11 May 2020 18:12:30 +0545 Subject: [PATCH 3/3] Add changelog for files_external/3rdparty/icewind/streams-0.7.2 --- changelog/unreleased/37249 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/unreleased/37249 diff --git a/changelog/unreleased/37249 b/changelog/unreleased/37249 new file mode 100644 index 000000000000..73aadf61a229 --- /dev/null +++ b/changelog/unreleased/37249 @@ -0,0 +1,3 @@ +Change: Update icewind/streams from 0.7.1 to 0.7.2 in files_external/3rdparty + +https://github.com/owncloud/core/pull/37249