diff options
Diffstat (limited to 'apps/files_external/3rdparty')
82 files changed, 0 insertions, 5656 deletions
diff --git a/apps/files_external/3rdparty/.gitignore b/apps/files_external/3rdparty/.gitignore deleted file mode 100644 index a7913dd4308..00000000000 --- a/apps/files_external/3rdparty/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -example.php -icewind/smb/tests -icewind/smb/install_libsmbclient.sh -icewind/smb/.travis.yml -icewind/smb/.scrutinizer.yml -icewind/streams/tests diff --git a/apps/files_external/3rdparty/autoload.php b/apps/files_external/3rdparty/autoload.php deleted file mode 100644 index 5875a3b996a..00000000000 --- a/apps/files_external/3rdparty/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -// autoload.php @generated by Composer - -require_once __DIR__ . '/composer/autoload_real.php'; - -return ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3::getLoader(); diff --git a/apps/files_external/3rdparty/composer.json b/apps/files_external/3rdparty/composer.json deleted file mode 100644 index 307a062c7e0..00000000000 --- a/apps/files_external/3rdparty/composer.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "files_external/3rdparty", - "description": "3rdparty components for files_external", - "license": "MIT", - "config": { - "vendor-dir": ".", - "optimize-autoloader": true, - "classmap-authoritative": true - }, - "require": { - "icewind/smb": "2.0.3", - "icewind/streams": "0.5.2" - } -} - diff --git a/apps/files_external/3rdparty/composer.lock b/apps/files_external/3rdparty/composer.lock deleted file mode 100644 index e00a7bd80e4..00000000000 --- a/apps/files_external/3rdparty/composer.lock +++ /dev/null @@ -1,100 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "b6a304e8ab2effa3791b513007fadcbc", - "packages": [ - { - "name": "icewind/smb", - "version": "v2.0.3", - "source": { - "type": "git", - "url": "https://github.com/icewind1991/SMB.git", - "reference": "8394551bf29a37b884edb33dae8acde369177f32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/icewind1991/SMB/zipball/8394551bf29a37b884edb33dae8acde369177f32", - "reference": "8394551bf29a37b884edb33dae8acde369177f32", - "shasum": "" - }, - "require": { - "icewind/streams": ">=0.2.0", - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Icewind\\SMB\\": "src/", - "Icewind\\SMB\\Test\\": "tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Robin Appelman", - "email": "icewind@owncloud.com" - } - ], - "description": "php wrapper for smbclient and libsmbclient-php", - "time": "2017-10-18T16:21:10+00:00" - }, - { - "name": "icewind/streams", - "version": "0.5.2", - "source": { - "type": "git", - "url": "https://github.com/icewind1991/Streams.git", - "reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/icewind1991/Streams/zipball/6bfd2fdbd99319f5e010d0a684409189a562cb1e", - "reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "^4.8", - "satooshi/php-coveralls": "v1.0.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Icewind\\Streams\\Tests\\": "tests/", - "Icewind\\Streams\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Robin Appelman", - "email": "icewind@owncloud.com" - } - ], - "description": "A set of generic stream wrappers", - "time": "2016-12-02T14:21:23+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/apps/files_external/3rdparty/composer/ClassLoader.php b/apps/files_external/3rdparty/composer/ClassLoader.php deleted file mode 100644 index 2c72175e772..00000000000 --- a/apps/files_external/3rdparty/composer/ClassLoader.php +++ /dev/null @@ -1,445 +0,0 @@ -<?php - -/* - * This file is part of Composer. - * - * (c) Nils Adermann <naderman@naderman.de> - * Jordi Boggiano <j.boggiano@seld.be> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier <fabien@symfony.com> - * @author Jordi Boggiano <j.boggiano@seld.be> - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - private $apcuPrefix; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; - if (isset($this->prefixDirsPsr4[$search])) { - foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/apps/files_external/3rdparty/composer/LICENSE b/apps/files_external/3rdparty/composer/LICENSE deleted file mode 100644 index f27399a042d..00000000000 --- a/apps/files_external/3rdparty/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -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 deleted file mode 100644 index 257bdb64eb5..00000000000 --- a/apps/files_external/3rdparty/composer/autoload_classmap.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -// autoload_classmap.php @generated by Composer - -$vendorDir = dirname(dirname(__FILE__)); -$baseDir = $vendorDir; - -return array( - 'Icewind\\SMB\\AbstractShare' => $vendorDir . '/icewind/smb/src/AbstractShare.php', - 'Icewind\\SMB\\Change' => $vendorDir . '/icewind/smb/src/Change.php', - 'Icewind\\SMB\\Connection' => $vendorDir . '/icewind/smb/src/Connection.php', - 'Icewind\\SMB\\ErrorCodes' => $vendorDir . '/icewind/smb/src/ErrorCodes.php', - 'Icewind\\SMB\\Exception\\AccessDeniedException' => $vendorDir . '/icewind/smb/src/Exception/AccessDeniedException.php', - 'Icewind\\SMB\\Exception\\AlreadyExistsException' => $vendorDir . '/icewind/smb/src/Exception/AlreadyExistsException.php', - 'Icewind\\SMB\\Exception\\AuthenticationException' => $vendorDir . '/icewind/smb/src/Exception/AuthenticationException.php', - 'Icewind\\SMB\\Exception\\ConnectException' => $vendorDir . '/icewind/smb/src/Exception/ConnectException.php', - 'Icewind\\SMB\\Exception\\ConnectionException' => $vendorDir . '/icewind/smb/src/Exception/ConnectionException.php', - 'Icewind\\SMB\\Exception\\ConnectionRefusedException' => $vendorDir . '/icewind/smb/src/Exception/ConnectionRefusedException.php', - 'Icewind\\SMB\\Exception\\DependencyException' => $vendorDir . '/icewind/smb/src/Exception/DependencyException.php', - 'Icewind\\SMB\\Exception\\Exception' => $vendorDir . '/icewind/smb/src/Exception/Exception.php', - 'Icewind\\SMB\\Exception\\FileInUseException' => $vendorDir . '/icewind/smb/src/Exception/FileInUseException.php', - 'Icewind\\SMB\\Exception\\ForbiddenException' => $vendorDir . '/icewind/smb/src/Exception/ForbiddenException.php', - 'Icewind\\SMB\\Exception\\HostDownException' => $vendorDir . '/icewind/smb/src/Exception/HostDownException.php', - 'Icewind\\SMB\\Exception\\InvalidHostException' => $vendorDir . '/icewind/smb/src/Exception/InvalidHostException.php', - 'Icewind\\SMB\\Exception\\InvalidParameterException' => $vendorDir . '/icewind/smb/src/Exception/InvalidParameterException.php', - 'Icewind\\SMB\\Exception\\InvalidPathException' => $vendorDir . '/icewind/smb/src/Exception/InvalidPathException.php', - 'Icewind\\SMB\\Exception\\InvalidRequestException' => $vendorDir . '/icewind/smb/src/Exception/InvalidRequestException.php', - 'Icewind\\SMB\\Exception\\InvalidResourceException' => $vendorDir . '/icewind/smb/src/Exception/InvalidResourceException.php', - 'Icewind\\SMB\\Exception\\InvalidTypeException' => $vendorDir . '/icewind/smb/src/Exception/InvalidTypeException.php', - 'Icewind\\SMB\\Exception\\NoLoginServerException' => $vendorDir . '/icewind/smb/src/Exception/NoLoginServerException.php', - 'Icewind\\SMB\\Exception\\NoRouteToHostException' => $vendorDir . '/icewind/smb/src/Exception/NoRouteToHostException.php', - 'Icewind\\SMB\\Exception\\NotEmptyException' => $vendorDir . '/icewind/smb/src/Exception/NotEmptyException.php', - 'Icewind\\SMB\\Exception\\NotFoundException' => $vendorDir . '/icewind/smb/src/Exception/NotFoundException.php', - 'Icewind\\SMB\\Exception\\OutOfSpaceException' => $vendorDir . '/icewind/smb/src/Exception/OutOfSpaceException.php', - 'Icewind\\SMB\\Exception\\RevisionMismatchException' => $vendorDir . '/icewind/smb/src/Exception/RevisionMismatchException.php', - 'Icewind\\SMB\\Exception\\TimedOutException' => $vendorDir . '/icewind/smb/src/Exception/TimedOutException.php', - 'Icewind\\SMB\\FileInfo' => $vendorDir . '/icewind/smb/src/FileInfo.php', - 'Icewind\\SMB\\IFileInfo' => $vendorDir . '/icewind/smb/src/IFileInfo.php', - 'Icewind\\SMB\\INotifyHandler' => $vendorDir . '/icewind/smb/src/INotifyHandler.php', - 'Icewind\\SMB\\IShare' => $vendorDir . '/icewind/smb/src/IShare.php', - 'Icewind\\SMB\\NativeFileInfo' => $vendorDir . '/icewind/smb/src/NativeFileInfo.php', - 'Icewind\\SMB\\NativeReadStream' => $vendorDir . '/icewind/smb/src/NativeReadStream.php', - 'Icewind\\SMB\\NativeServer' => $vendorDir . '/icewind/smb/src/NativeServer.php', - 'Icewind\\SMB\\NativeShare' => $vendorDir . '/icewind/smb/src/NativeShare.php', - 'Icewind\\SMB\\NativeState' => $vendorDir . '/icewind/smb/src/NativeState.php', - 'Icewind\\SMB\\NativeStream' => $vendorDir . '/icewind/smb/src/NativeStream.php', - 'Icewind\\SMB\\NativeWriteStream' => $vendorDir . '/icewind/smb/src/NativeWriteStream.php', - 'Icewind\\SMB\\NotifyHandler' => $vendorDir . '/icewind/smb/src/NotifyHandler.php', - 'Icewind\\SMB\\Parser' => $vendorDir . '/icewind/smb/src/Parser.php', - 'Icewind\\SMB\\RawConnection' => $vendorDir . '/icewind/smb/src/RawConnection.php', - 'Icewind\\SMB\\Server' => $vendorDir . '/icewind/smb/src/Server.php', - 'Icewind\\SMB\\Share' => $vendorDir . '/icewind/smb/src/Share.php', - 'Icewind\\SMB\\System' => $vendorDir . '/icewind/smb/src/System.php', - 'Icewind\\SMB\\Test\\AbstractShare' => $vendorDir . '/icewind/smb/tests/AbstractShare.php', - 'Icewind\\SMB\\Test\\NativeShare' => $vendorDir . '/icewind/smb/tests/NativeShare.php', - 'Icewind\\SMB\\Test\\NativeStream' => $vendorDir . '/icewind/smb/tests/NativeStream.php', - 'Icewind\\SMB\\Test\\NotifyHandlerTest' => $vendorDir . '/icewind/smb/tests/NotifyHandlerTest.php', - 'Icewind\\SMB\\Test\\Parser' => $vendorDir . '/icewind/smb/tests/Parser.php', - 'Icewind\\SMB\\Test\\Server' => $vendorDir . '/icewind/smb/tests/Server.php', - 'Icewind\\SMB\\Test\\Share' => $vendorDir . '/icewind/smb/tests/Share.php', - 'Icewind\\SMB\\Test\\TestCase' => $vendorDir . '/icewind/smb/tests/TestCase.php', - 'Icewind\\SMB\\TimeZoneProvider' => $vendorDir . '/icewind/smb/src/TimeZoneProvider.php', - 'Icewind\\Streams\\CallbackWrapper' => $vendorDir . '/icewind/streams/src/CallbackWrapper.php', - 'Icewind\\Streams\\Directory' => $vendorDir . '/icewind/streams/src/Directory.php', - '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\\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\\RetryWrapper' => $vendorDir . '/icewind/streams/src/RetryWrapper.php', - 'Icewind\\Streams\\SeekableWrapper' => $vendorDir . '/icewind/streams/src/SeekableWrapper.php', - 'Icewind\\Streams\\Tests\\CallbackWrapper' => $vendorDir . '/icewind/streams/tests/CallbackWrapper.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\\NullWrapper' => $vendorDir . '/icewind/streams/tests/NullWrapper.php', - 'Icewind\\Streams\\Tests\\PartialWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\PathWrapper' => $vendorDir . '/icewind/streams/tests/PathWrapper.php', - 'Icewind\\Streams\\Tests\\RetryWrapper' => $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\\Wrapper' => $vendorDir . '/icewind/streams/tests/Wrapper.php', - 'Icewind\\Streams\\Url' => $vendorDir . '/icewind/streams/src/Url.php', - 'Icewind\\Streams\\UrlCallback' => $vendorDir . '/icewind/streams/src/UrlCallBack.php', - 'Icewind\\Streams\\Wrapper' => $vendorDir . '/icewind/streams/src/Wrapper.php', -); diff --git a/apps/files_external/3rdparty/composer/autoload_namespaces.php b/apps/files_external/3rdparty/composer/autoload_namespaces.php deleted file mode 100644 index 71c9e91858d..00000000000 --- a/apps/files_external/3rdparty/composer/autoload_namespaces.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -// autoload_namespaces.php @generated by Composer - -$vendorDir = dirname(dirname(__FILE__)); -$baseDir = $vendorDir; - -return array( -); diff --git a/apps/files_external/3rdparty/composer/autoload_psr4.php b/apps/files_external/3rdparty/composer/autoload_psr4.php deleted file mode 100644 index 7cfe0f1c46d..00000000000 --- a/apps/files_external/3rdparty/composer/autoload_psr4.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -// autoload_psr4.php @generated by Composer - -$vendorDir = dirname(dirname(__FILE__)); -$baseDir = $vendorDir; - -return array( - '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_real.php b/apps/files_external/3rdparty/composer/autoload_real.php deleted file mode 100644 index 4ac68127fea..00000000000 --- a/apps/files_external/3rdparty/composer/autoload_real.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -// autoload_real.php @generated by Composer - -class ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3 -{ - private static $loader; - - public static function loadClassLoader($class) - { - if ('Composer\Autoload\ClassLoader' === $class) { - require __DIR__ . '/ClassLoader.php'; - } - } - - public static function getLoader() - { - if (null !== self::$loader) { - return self::$loader; - } - - spl_autoload_register(array('ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3', 'loadClassLoader')); - - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::getInitializer($loader)); - } else { - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->setClassMapAuthoritative(true); - $loader->register(true); - - return $loader; - } -} diff --git a/apps/files_external/3rdparty/composer/autoload_static.php b/apps/files_external/3rdparty/composer/autoload_static.php deleted file mode 100644 index 62be2df6a0d..00000000000 --- a/apps/files_external/3rdparty/composer/autoload_static.php +++ /dev/null @@ -1,132 +0,0 @@ -<?php - -// autoload_static.php @generated by Composer - -namespace Composer\Autoload; - -class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3 -{ - public static $prefixLengthsPsr4 = array ( - 'I' => - array ( - 'Icewind\\Streams\\Tests\\' => 22, - 'Icewind\\Streams\\' => 16, - 'Icewind\\SMB\\Test\\' => 17, - 'Icewind\\SMB\\' => 12, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Icewind\\Streams\\Tests\\' => - array ( - 0 => __DIR__ . '/..' . '/icewind/streams/tests', - ), - 'Icewind\\Streams\\' => - array ( - 0 => __DIR__ . '/..' . '/icewind/streams/src', - ), - 'Icewind\\SMB\\Test\\' => - array ( - 0 => __DIR__ . '/..' . '/icewind/smb/tests', - ), - 'Icewind\\SMB\\' => - array ( - 0 => __DIR__ . '/..' . '/icewind/smb/src', - ), - ); - - public static $classMap = array ( - 'Icewind\\SMB\\AbstractShare' => __DIR__ . '/..' . '/icewind/smb/src/AbstractShare.php', - 'Icewind\\SMB\\Change' => __DIR__ . '/..' . '/icewind/smb/src/Change.php', - 'Icewind\\SMB\\Connection' => __DIR__ . '/..' . '/icewind/smb/src/Connection.php', - 'Icewind\\SMB\\ErrorCodes' => __DIR__ . '/..' . '/icewind/smb/src/ErrorCodes.php', - 'Icewind\\SMB\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AccessDeniedException.php', - 'Icewind\\SMB\\Exception\\AlreadyExistsException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AlreadyExistsException.php', - 'Icewind\\SMB\\Exception\\AuthenticationException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AuthenticationException.php', - 'Icewind\\SMB\\Exception\\ConnectException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectException.php', - 'Icewind\\SMB\\Exception\\ConnectionException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectionException.php', - 'Icewind\\SMB\\Exception\\ConnectionRefusedException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectionRefusedException.php', - 'Icewind\\SMB\\Exception\\DependencyException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/DependencyException.php', - 'Icewind\\SMB\\Exception\\Exception' => __DIR__ . '/..' . '/icewind/smb/src/Exception/Exception.php', - 'Icewind\\SMB\\Exception\\FileInUseException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/FileInUseException.php', - 'Icewind\\SMB\\Exception\\ForbiddenException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ForbiddenException.php', - 'Icewind\\SMB\\Exception\\HostDownException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/HostDownException.php', - 'Icewind\\SMB\\Exception\\InvalidHostException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidHostException.php', - 'Icewind\\SMB\\Exception\\InvalidParameterException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidParameterException.php', - 'Icewind\\SMB\\Exception\\InvalidPathException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidPathException.php', - 'Icewind\\SMB\\Exception\\InvalidRequestException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidRequestException.php', - 'Icewind\\SMB\\Exception\\InvalidResourceException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidResourceException.php', - 'Icewind\\SMB\\Exception\\InvalidTypeException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidTypeException.php', - 'Icewind\\SMB\\Exception\\NoLoginServerException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/NoLoginServerException.php', - 'Icewind\\SMB\\Exception\\NoRouteToHostException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/NoRouteToHostException.php', - 'Icewind\\SMB\\Exception\\NotEmptyException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/NotEmptyException.php', - 'Icewind\\SMB\\Exception\\NotFoundException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/NotFoundException.php', - 'Icewind\\SMB\\Exception\\OutOfSpaceException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/OutOfSpaceException.php', - 'Icewind\\SMB\\Exception\\RevisionMismatchException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/RevisionMismatchException.php', - 'Icewind\\SMB\\Exception\\TimedOutException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/TimedOutException.php', - 'Icewind\\SMB\\FileInfo' => __DIR__ . '/..' . '/icewind/smb/src/FileInfo.php', - 'Icewind\\SMB\\IFileInfo' => __DIR__ . '/..' . '/icewind/smb/src/IFileInfo.php', - 'Icewind\\SMB\\INotifyHandler' => __DIR__ . '/..' . '/icewind/smb/src/INotifyHandler.php', - 'Icewind\\SMB\\IShare' => __DIR__ . '/..' . '/icewind/smb/src/IShare.php', - 'Icewind\\SMB\\NativeFileInfo' => __DIR__ . '/..' . '/icewind/smb/src/NativeFileInfo.php', - 'Icewind\\SMB\\NativeReadStream' => __DIR__ . '/..' . '/icewind/smb/src/NativeReadStream.php', - 'Icewind\\SMB\\NativeServer' => __DIR__ . '/..' . '/icewind/smb/src/NativeServer.php', - 'Icewind\\SMB\\NativeShare' => __DIR__ . '/..' . '/icewind/smb/src/NativeShare.php', - 'Icewind\\SMB\\NativeState' => __DIR__ . '/..' . '/icewind/smb/src/NativeState.php', - 'Icewind\\SMB\\NativeStream' => __DIR__ . '/..' . '/icewind/smb/src/NativeStream.php', - 'Icewind\\SMB\\NativeWriteStream' => __DIR__ . '/..' . '/icewind/smb/src/NativeWriteStream.php', - 'Icewind\\SMB\\NotifyHandler' => __DIR__ . '/..' . '/icewind/smb/src/NotifyHandler.php', - 'Icewind\\SMB\\Parser' => __DIR__ . '/..' . '/icewind/smb/src/Parser.php', - 'Icewind\\SMB\\RawConnection' => __DIR__ . '/..' . '/icewind/smb/src/RawConnection.php', - 'Icewind\\SMB\\Server' => __DIR__ . '/..' . '/icewind/smb/src/Server.php', - 'Icewind\\SMB\\Share' => __DIR__ . '/..' . '/icewind/smb/src/Share.php', - 'Icewind\\SMB\\System' => __DIR__ . '/..' . '/icewind/smb/src/System.php', - 'Icewind\\SMB\\Test\\AbstractShare' => __DIR__ . '/..' . '/icewind/smb/tests/AbstractShare.php', - 'Icewind\\SMB\\Test\\NativeShare' => __DIR__ . '/..' . '/icewind/smb/tests/NativeShare.php', - 'Icewind\\SMB\\Test\\NativeStream' => __DIR__ . '/..' . '/icewind/smb/tests/NativeStream.php', - 'Icewind\\SMB\\Test\\NotifyHandlerTest' => __DIR__ . '/..' . '/icewind/smb/tests/NotifyHandlerTest.php', - 'Icewind\\SMB\\Test\\Parser' => __DIR__ . '/..' . '/icewind/smb/tests/Parser.php', - 'Icewind\\SMB\\Test\\Server' => __DIR__ . '/..' . '/icewind/smb/tests/Server.php', - 'Icewind\\SMB\\Test\\Share' => __DIR__ . '/..' . '/icewind/smb/tests/Share.php', - 'Icewind\\SMB\\Test\\TestCase' => __DIR__ . '/..' . '/icewind/smb/tests/TestCase.php', - 'Icewind\\SMB\\TimeZoneProvider' => __DIR__ . '/..' . '/icewind/smb/src/TimeZoneProvider.php', - 'Icewind\\Streams\\CallbackWrapper' => __DIR__ . '/..' . '/icewind/streams/src/CallbackWrapper.php', - 'Icewind\\Streams\\Directory' => __DIR__ . '/..' . '/icewind/streams/src/Directory.php', - '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\\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\\RetryWrapper' => __DIR__ . '/..' . '/icewind/streams/src/RetryWrapper.php', - 'Icewind\\Streams\\SeekableWrapper' => __DIR__ . '/..' . '/icewind/streams/src/SeekableWrapper.php', - 'Icewind\\Streams\\Tests\\CallbackWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/CallbackWrapper.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\\NullWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/NullWrapper.php', - 'Icewind\\Streams\\Tests\\PartialWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php', - 'Icewind\\Streams\\Tests\\PathWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/PathWrapper.php', - 'Icewind\\Streams\\Tests\\RetryWrapper' => __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\\Wrapper' => __DIR__ . '/..' . '/icewind/streams/tests/Wrapper.php', - 'Icewind\\Streams\\Url' => __DIR__ . '/..' . '/icewind/streams/src/Url.php', - 'Icewind\\Streams\\UrlCallback' => __DIR__ . '/..' . '/icewind/streams/src/UrlCallBack.php', - 'Icewind\\Streams\\Wrapper' => __DIR__ . '/..' . '/icewind/streams/src/Wrapper.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$classMap; - - }, null, ClassLoader::class); - } -} diff --git a/apps/files_external/3rdparty/composer/installed.json b/apps/files_external/3rdparty/composer/installed.json deleted file mode 100644 index 6855971a9f1..00000000000 --- a/apps/files_external/3rdparty/composer/installed.json +++ /dev/null @@ -1,88 +0,0 @@ -[ - { - "name": "icewind/streams", - "version": "0.5.2", - "version_normalized": "0.5.2.0", - "source": { - "type": "git", - "url": "https://github.com/icewind1991/Streams.git", - "reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/icewind1991/Streams/zipball/6bfd2fdbd99319f5e010d0a684409189a562cb1e", - "reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "^4.8", - "satooshi/php-coveralls": "v1.0.0" - }, - "time": "2016-12-02T14:21:23+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Icewind\\Streams\\Tests\\": "tests/", - "Icewind\\Streams\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Robin Appelman", - "email": "icewind@owncloud.com" - } - ], - "description": "A set of generic stream wrappers" - }, - { - "name": "icewind/smb", - "version": "v2.0.3", - "version_normalized": "2.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/icewind1991/SMB.git", - "reference": "8394551bf29a37b884edb33dae8acde369177f32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/icewind1991/SMB/zipball/8394551bf29a37b884edb33dae8acde369177f32", - "reference": "8394551bf29a37b884edb33dae8acde369177f32", - "shasum": "" - }, - "require": { - "icewind/streams": ">=0.2.0", - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "time": "2017-10-18T16:21:10+00:00", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-4": { - "Icewind\\SMB\\": "src/", - "Icewind\\SMB\\Test\\": "tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Robin Appelman", - "email": "icewind@owncloud.com" - } - ], - "description": "php wrapper for smbclient and libsmbclient-php" - } -] diff --git a/apps/files_external/3rdparty/icewind/smb/.gitignore b/apps/files_external/3rdparty/icewind/smb/.gitignore deleted file mode 100644 index 4f389129e2d..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.idea -vendor -composer.lock diff --git a/apps/files_external/3rdparty/icewind/smb/LICENSE.txt b/apps/files_external/3rdparty/icewind/smb/LICENSE.txt deleted file mode 100644 index 16e3a1004ec..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - -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/icewind/smb/README.md b/apps/files_external/3rdparty/icewind/smb/README.md deleted file mode 100644 index c8f31193c83..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/README.md +++ /dev/null @@ -1,152 +0,0 @@ -SMB -=== - -[](https://scrutinizer-ci.com/g/icewind1991/SMB/?branch=master) -[](https://travis-ci.org/icewind1991/SMB) -[](https://scrutinizer-ci.com/g/icewind1991/SMB/?branch=master) - -PHP wrapper for `smbclient` and [`libsmbclient-php`](https://github.com/eduardok/libsmbclient-php) - -- Reuses a single `smbclient` instance for multiple requests -- Doesn't leak the password to the process list -- Simple 1-on-1 mapping of SMB commands -- A stream-based api to remove the need for temporary files -- Support for using libsmbclient directly trough [`libsmbclient-php`](https://github.com/eduardok/libsmbclient-php) - -Examples ----- - -### Upload a file ### - -```php -<?php -use Icewind\SMB\Server; - -require('vendor/autoload.php'); - -$fileToUpload = __FILE__; - -$server = new Server('localhost', 'test', 'test'); -$share = $server->getShare('test'); -$share->put($fileToUpload, 'example.txt'); -``` - -### Download a file ### - -```php -<?php -use Icewind\SMB\Server; - -require('vendor/autoload.php'); - -$target = __DIR__ . '/target.txt'; - -$server = new Server('localhost', 'test', 'test'); -$share = $server->getShare('test'); -$share->get('example.txt', $target); -``` - -### List shares on the remote server ### - -```php -<?php -use Icewind\SMB\Server; - -require('vendor/autoload.php'); - -$server = new Server('localhost', 'test', 'test'); -$shares = $server->listShares(); - -foreach ($shares as $share) { - echo $share->getName() . "\n"; -} -``` - -### List the content of a folder ### - -```php -<?php -use Icewind\SMB\Server; - -require('vendor/autoload.php'); - -$server = new Server('localhost', 'test', 'test'); -$share = $server->getShare('test'); -$content = $share->dir('test'); - -foreach ($content as $info) { - echo $info->getName() . "\n"; - echo "\tsize :" . $info->getSize() . "\n"; -} -``` - -### Using read streams - -```php -<?php -use Icewind\SMB\Server; - -require('vendor/autoload.php'); - -$server = new Server('localhost', 'test', 'test'); -$share = $server->getShare('test'); - -$fh = $share->read('test.txt'); -echo fread($fh, 4086); -fclose($fh); -``` - -### Using write streams - -```php -<?php -use Icewind\SMB\Server; - -require('vendor/autoload.php'); - -$server = new Server('localhost', 'test', 'test'); -$share = $server->getShare('test'); - -$fh = $share->write('test.txt'); -fwrite($fh, 'bar'); -fclose($fh); -``` - -### Using libsmbclient-php ### - -Install [libsmbclient-php](https://github.com/eduardok/libsmbclient-php) - -```php -<?php -use Icewind\SMB\Server; -use Icewind\SMB\NativeServer; - -require('vendor/autoload.php'); - -$fileToUpload = __FILE__; - -if (Server::NativeAvailable()) { - $server = new NativeServer('localhost', 'test', 'test'); -} else { - echo 'libsmbclient-php not available, falling back to wrapping smbclient'; - $server = new Server('localhost', 'test', 'test'); -} -$share = $server->getShare('test'); -$share->put($fileToUpload, 'example.txt'); -``` - -### Using notify - -```php -<?php -use Icewind\SMB\Server; - -require('vendor/autoload.php'); - -$server = new Server('localhost', 'test', 'test'); -$share = $server->getShare('test'); - -$share->notify('')->listen(function (\Icewind\SMB\Change $change) { - echo $change->getCode() . ': ' . $change->getPath() . "\n"; -}); -``` diff --git a/apps/files_external/3rdparty/icewind/smb/composer.json b/apps/files_external/3rdparty/icewind/smb/composer.json deleted file mode 100644 index 8374f564bf1..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name" : "icewind/smb", - "description" : "php wrapper for smbclient and libsmbclient-php", - "license" : "MIT", - "authors" : [ - { - "name" : "Robin Appelman", - "email": "icewind@owncloud.com" - } - ], - "require" : { - "php": ">=5.4", - "icewind/streams": ">=0.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "autoload" : { - "psr-4": { - "Icewind\\SMB\\": "src/", - "Icewind\\SMB\\Test\\": "tests/" - } - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/AbstractShare.php b/apps/files_external/3rdparty/icewind/smb/src/AbstractShare.php deleted file mode 100644 index a5cfe59a3c4..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/AbstractShare.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\InvalidPathException; - -abstract class AbstractShare implements IShare { - private $forbiddenCharacters; - - public function __construct() { - $this->forbiddenCharacters = array('?', '<', '>', ':', '*', '|', '"', chr(0), "\n", "\r"); - } - - protected function verifyPath($path) { - foreach ($this->forbiddenCharacters as $char) { - if (strpos($path, $char) !== false) { - throw new InvalidPathException('Invalid path, "' . $char . '" is not allowed'); - } - } - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Change.php b/apps/files_external/3rdparty/icewind/smb/src/Change.php deleted file mode 100644 index 9dfd57b3973..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Change.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016 Robin Appelman <robin@icewind.nl> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - * - */ - -namespace Icewind\SMB; - -class Change { - private $code; - - private $path; - - /** - * Change constructor. - * - * @param $code - * @param $path - */ - public function __construct($code, $path) { - $this->code = $code; - $this->path = $path; - } - - /** - * @return integer - */ - public function getCode() { - return $this->code; - } - - /** - * @return string - */ - public function getPath() { - return $this->path; - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Connection.php b/apps/files_external/3rdparty/icewind/smb/src/Connection.php deleted file mode 100644 index c1ebb861711..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Connection.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\AuthenticationException; -use Icewind\SMB\Exception\ConnectException; -use Icewind\SMB\Exception\ConnectionException; -use Icewind\SMB\Exception\InvalidHostException; -use Icewind\SMB\Exception\NoLoginServerException; - -class Connection extends RawConnection { - const DELIMITER = 'smb:'; - const DELIMITER_LENGTH = 4; - - /** @var Parser */ - private $parser; - - public function __construct($command, Parser $parser, $env = array()) { - parent::__construct($command, $env); - $this->parser = $parser; - } - - /** - * send input to smbclient - * - * @param string $input - */ - public function write($input) { - parent::write($input . PHP_EOL); - } - - /** - * get all unprocessed output from smbclient until the next prompt - * - * @param callable $callback (optional) callback to call for every line read - * @return string[] - * @throws AuthenticationException - * @throws ConnectException - * @throws ConnectionException - * @throws InvalidHostException - * @throws NoLoginServerException - */ - public function read(callable $callback = null) { - if (!$this->isValid()) { - throw new ConnectionException('Connection not valid'); - } - $promptLine = $this->readLine(); //first line is prompt - $this->parser->checkConnectionError($promptLine); - - $output = array(); - $line = $this->readLine(); - if ($line === false) { - $this->unknownError($promptLine); - } - while (!$this->isPrompt($line)) { //next prompt functions as delimiter - if (is_callable($callback)) { - $result = $callback($line); - if ($result === false) { // allow the callback to close the connection for infinite running commands - $this->close(true); - break; - } - } else { - $output[] .= $line; - } - $line = $this->readLine(); - } - return $output; - } - - /** - * Check - * - * @param $line - * @return bool - */ - private function isPrompt($line) { - return mb_substr($line, 0, self::DELIMITER_LENGTH) === self::DELIMITER || $line === false; - } - - /** - * @param string $promptLine (optional) prompt line that might contain some info about the error - * @throws ConnectException - */ - private function unknownError($promptLine = '') { - if ($promptLine) { //maybe we have some error we missed on the previous line - throw new ConnectException('Unknown error (' . $promptLine . ')'); - } else { - $error = $this->readError(); // maybe something on stderr - if ($error) { - throw new ConnectException('Unknown error (' . $error . ')'); - } else { - throw new ConnectException('Unknown error'); - } - } - } - - public function close($terminate = true) { - if (is_resource($this->getInputStream())) { - $this->write('close' . PHP_EOL); - } - parent::close($terminate); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/ErrorCodes.php b/apps/files_external/3rdparty/icewind/smb/src/ErrorCodes.php deleted file mode 100644 index d36cdaf2c7d..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/ErrorCodes.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -class ErrorCodes { - /** - * connection errors - */ - const LogonFailure = 'NT_STATUS_LOGON_FAILURE'; - const BadHostName = 'NT_STATUS_BAD_NETWORK_NAME'; - const Unsuccessful = 'NT_STATUS_UNSUCCESSFUL'; - const ConnectionRefused = 'NT_STATUS_CONNECTION_REFUSED'; - const NoLogonServers = 'NT_STATUS_NO_LOGON_SERVERS'; - - const PathNotFound = 'NT_STATUS_OBJECT_PATH_NOT_FOUND'; - const NoSuchFile = 'NT_STATUS_NO_SUCH_FILE'; - const ObjectNotFound = 'NT_STATUS_OBJECT_NAME_NOT_FOUND'; - const NameCollision = 'NT_STATUS_OBJECT_NAME_COLLISION'; - const AccessDenied = 'NT_STATUS_ACCESS_DENIED'; - const DirectoryNotEmpty = 'NT_STATUS_DIRECTORY_NOT_EMPTY'; - const FileIsADirectory = 'NT_STATUS_FILE_IS_A_DIRECTORY'; - const NotADirectory = 'NT_STATUS_NOT_A_DIRECTORY'; - const SharingViolation = 'NT_STATUS_SHARING_VIOLATION'; - const InvalidParameter = 'NT_STATUS_INVALID_PARAMETER'; - const RevisionMismatch = 'NT_STATUS_REVISION_MISMATCH'; -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/AccessDeniedException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/AccessDeniedException.php deleted file mode 100644 index 4b7d22b3540..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/AccessDeniedException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class AccessDeniedException extends ConnectException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/AlreadyExistsException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/AlreadyExistsException.php deleted file mode 100644 index 4636b9d1786..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/AlreadyExistsException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class AlreadyExistsException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/AuthenticationException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/AuthenticationException.php deleted file mode 100644 index ddf5d7e34dc..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/AuthenticationException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class AuthenticationException extends ConnectException{} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectException.php deleted file mode 100644 index 310d441bf5c..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class ConnectException extends Exception {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectionException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectionException.php deleted file mode 100644 index 21033560fc0..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectionException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class ConnectionException extends ConnectException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectionRefusedException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectionRefusedException.php deleted file mode 100644 index ffebb4c8a51..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/ConnectionRefusedException.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class ConnectionRefusedException extends ConnectException { -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/DependencyException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/DependencyException.php deleted file mode 100644 index 39735578798..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/DependencyException.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright (c) 2016 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class DependencyException extends Exception { -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php deleted file mode 100644 index 93f2c1b3e2e..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class Exception extends \Exception { - static public function unknown($path, $error) { - $message = 'Unknown error (' . $error . ')'; - if ($path) { - $message .= ' for ' . $path; - } - - return new Exception($message, is_string($error) ? 0 : $error); - } - - /** - * @param array $exceptionMap - * @param mixed $error - * @param string $path - * @return Exception - */ - static public function fromMap(array $exceptionMap, $error, $path) { - if (isset($exceptionMap[$error])) { - $exceptionClass = $exceptionMap[$error]; - if (is_numeric($error)) { - return new $exceptionClass($path, $error); - } else { - return new $exceptionClass($path); - } - } else { - return Exception::unknown($path, $error); - } - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/FileInUseException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/FileInUseException.php deleted file mode 100644 index 46460eb6936..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/FileInUseException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class FileInUseException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/ForbiddenException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/ForbiddenException.php deleted file mode 100644 index 117d6a438ea..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/ForbiddenException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class ForbiddenException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/HostDownException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/HostDownException.php deleted file mode 100644 index 9ae762b6108..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/HostDownException.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class HostDownException extends ConnectException { -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidHostException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidHostException.php deleted file mode 100644 index 4b17f1a4de6..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidHostException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class InvalidHostException extends ConnectException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidParameterException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidParameterException.php deleted file mode 100644 index 163b571183d..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidParameterException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class InvalidParameterException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidPathException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidPathException.php deleted file mode 100644 index 4bba74f269f..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidPathException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class InvalidPathException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidRequestException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidRequestException.php deleted file mode 100644 index 882bf1677bf..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidRequestException.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class InvalidRequestException extends Exception { - /** - * @var string - */ - protected $path; - - /** - * @param string $path - * @param int $code - */ - public function __construct($path, $code = 0) { - $class = get_class($this); - $parts = explode('\\', $class); - $baseName = array_pop($parts); - parent::__construct('Invalid request for ' . $path . ' (' . $baseName . ')', $code); - $this->path = $path; - } - - /** - * @return string - */ - public function getPath() { - return $this->path; - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidResourceException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidResourceException.php deleted file mode 100644 index b5fdb851cab..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidResourceException.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class InvalidResourceException extends Exception { -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidTypeException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidTypeException.php deleted file mode 100644 index 63b79305ad4..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/InvalidTypeException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class InvalidTypeException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/NoLoginServerException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/NoLoginServerException.php deleted file mode 100644 index 43f7f9aeff9..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/NoLoginServerException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class NoLoginServerException extends ConnectException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/NoRouteToHostException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/NoRouteToHostException.php deleted file mode 100644 index 03daf36d610..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/NoRouteToHostException.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class NoRouteToHostException extends ConnectException { -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/NotEmptyException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/NotEmptyException.php deleted file mode 100644 index 789a76bcb9e..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/NotEmptyException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class NotEmptyException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/NotFoundException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/NotFoundException.php deleted file mode 100644 index 9ce97cd535b..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/NotFoundException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class NotFoundException extends InvalidRequestException {} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/OutOfSpaceException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/OutOfSpaceException.php deleted file mode 100644 index 4c5517a1404..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/OutOfSpaceException.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class OutOfSpaceException extends InvalidRequestException { -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/RevisionMismatchException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/RevisionMismatchException.php deleted file mode 100644 index e898b5a2347..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/RevisionMismatchException.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -use Throwable; - -class RevisionMismatchException extends Exception { - public function __construct($message = 'Protocol version mismatch', $code = 0, Throwable $previous = null) { - parent::__construct($message, $code, $previous); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Exception/TimedOutException.php b/apps/files_external/3rdparty/icewind/smb/src/Exception/TimedOutException.php deleted file mode 100644 index dd57c9b8ccc..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Exception/TimedOutException.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB\Exception; - -class TimedOutException extends ConnectException { -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/FileInfo.php b/apps/files_external/3rdparty/icewind/smb/src/FileInfo.php deleted file mode 100644 index ef9121a8f57..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/FileInfo.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -class FileInfo implements IFileInfo { - /* - * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the - * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or - * "system.*") is specified. - */ - const MODE_READONLY = 0x01; - const MODE_HIDDEN = 0x02; - const MODE_SYSTEM = 0x04; - const MODE_VOLUME_ID = 0x08; - const MODE_DIRECTORY = 0x10; - const MODE_ARCHIVE = 0x20; - const MODE_NORMAL = 0x80; - - /** - * @var string - */ - protected $path; - - /** - * @var string - */ - protected $name; - - /** - * @var int - */ - protected $size; - - /** - * @var int - */ - protected $time; - - /** - * @var int - */ - protected $mode; - - /** - * @param string $path - * @param string $name - * @param int $size - * @param int $time - * @param int $mode - */ - public function __construct($path, $name, $size, $time, $mode) { - $this->path = $path; - $this->name = $name; - $this->size = $size; - $this->time = $time; - $this->mode = $mode; - } - - /** - * @return string - */ - public function getPath() { - return $this->path; - } - - /** - * @return string - */ - public function getName() { - return $this->name; - } - - /** - * @return int - */ - public function getSize() { - return $this->size; - } - - /** - * @return int - */ - public function getMTime() { - return $this->time; - } - - /** - * @return bool - */ - public function isDirectory() { - return (bool)($this->mode & self::MODE_DIRECTORY); - } - - /** - * @return bool - */ - public function isReadOnly() { - return (bool)($this->mode & self::MODE_READONLY); - } - - /** - * @return bool - */ - public function isHidden() { - return (bool)($this->mode & self::MODE_HIDDEN); - } - - /** - * @return bool - */ - public function isSystem() { - return (bool)($this->mode & self::MODE_SYSTEM); - } - - /** - * @return bool - */ - public function isArchived() { - return (bool)($this->mode & self::MODE_ARCHIVE); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php b/apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php deleted file mode 100644 index 16ea8cfbd04..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -interface IFileInfo { - /** - * @return string - */ - public function getPath(); - - /** - * @return string - */ - public function getName(); - - /** - * @return int - */ - public function getSize(); - - /** - * @return int - */ - public function getMTime(); - - /** - * @return bool - */ - public function isDirectory(); - - /** - * @return bool - */ - public function isReadOnly(); - - /** - * @return bool - */ - public function isHidden(); - - /** - * @return bool - */ - public function isSystem(); - - /** - * @return bool - */ - public function isArchived(); -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/INotifyHandler.php b/apps/files_external/3rdparty/icewind/smb/src/INotifyHandler.php deleted file mode 100644 index 1ee59b26ddd..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/INotifyHandler.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016 Robin Appelman <robin@icewind.nl> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - * - */ - -namespace Icewind\SMB; - - -interface INotifyHandler { - // https://msdn.microsoft.com/en-us/library/dn392331.aspx - const NOTIFY_ADDED = 1; - const NOTIFY_REMOVED = 2; - const NOTIFY_MODIFIED = 3; - const NOTIFY_RENAMED_OLD = 4; - const NOTIFY_RENAMED_NEW = 5; - const NOTIFY_ADDED_STREAM = 6; - const NOTIFY_REMOVED_STREAM = 7; - const NOTIFY_MODIFIED_STREAM = 8; - const NOTIFY_REMOVED_BY_DELETE = 9; - - /** - * Get all changes detected since the start of the notify process or the last call to getChanges - * - * @return Change[] - */ - public function getChanges(); - - /** - * Listen actively to all incoming changes - * - * Note that this is a blocking process and will cause the process to block forever if not explicitly terminated - * - * @param callable $callback - */ - public function listen($callback); - - /** - * Stop listening for changes - * - * Note that any pending changes will be discarded - */ - public function stop(); -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/IShare.php b/apps/files_external/3rdparty/icewind/smb/src/IShare.php deleted file mode 100644 index 8f6d5058b81..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/IShare.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -interface IShare { - /** - * Get the name of the share - * - * @return string - */ - public function getName(); - - /** - * Download a remote file - * - * @param string $source remove file - * @param string $target local file - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function get($source, $target); - - /** - * Upload a local file - * - * @param string $source local file - * @param string $target remove file - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function put($source, $target); - - /** - * Open a readable stream top a remote file - * - * @param string $source - * @return resource a read only stream with the contents of the remote file - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function read($source); - - /** - * Open a writable stream to a remote file - * - * @param string $target - * @return resource a write only stream to upload a remote file - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function write($target); - - /** - * Rename a remote file - * - * @param string $from - * @param string $to - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\AlreadyExistsException - */ - public function rename($from, $to); - - /** - * Delete a file on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function del($path); - - /** - * List the content of a remote folder - * - * @param $path - * @return \Icewind\SMB\IFileInfo[] - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function dir($path); - - /** - * @param string $path - * @return \Icewind\SMB\IFileInfo - * - * @throws \Icewind\SMB\Exception\NotFoundException - */ - public function stat($path); - - /** - * Create a folder on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\AlreadyExistsException - */ - public function mkdir($path); - - /** - * Remove a folder on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function rmdir($path); - - /** - * @param string $path - * @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL - * @return mixed - */ - public function setMode($path, $mode); - - /** - * @param string $path - * @return INotifyHandler - */ - public function notify($path); -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeFileInfo.php b/apps/files_external/3rdparty/icewind/smb/src/NativeFileInfo.php deleted file mode 100644 index 6cb070196a6..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeFileInfo.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -class NativeFileInfo implements IFileInfo { - const MODE_FILE = 0100000; - - /** - * @var string - */ - protected $path; - - /** - * @var string - */ - protected $name; - - /** - * @var \Icewind\SMB\NativeShare - */ - protected $share; - - /** - * @var array|null - */ - protected $statCache; - - /** - * @var int - */ - protected $modeCache; - - /** - * @param \Icewind\SMB\NativeShare $share - * @param string $path - * @param string $name - * @param array $stat - */ - public function __construct($share, $path, $name, $stat = null) { - $this->share = $share; - $this->path = $path; - $this->name = $name; - $this->statCache = $stat; - } - - /** - * @return string - */ - public function getPath() { - return $this->path; - } - - /** - * @return string - */ - public function getName() { - return $this->name; - } - - /** - * @return array - */ - protected function stat() { - if (is_null($this->statCache)) { - $this->statCache = $this->share->getStat($this->getPath()); - } - return $this->statCache; - } - - /** - * @return int - */ - public function getSize() { - $stat = $this->stat(); - return $stat['size']; - } - - /** - * @return int - */ - public function getMTime() { - $stat = $this->stat(); - return $stat['mtime']; - } - - /** - * @return bool - */ - public function isDirectory() { - $stat = $this->stat(); - return !($stat['mode'] & self::MODE_FILE); - } - - /** - * @return int - */ - protected function getMode() { - if (!$this->modeCache) { - $attribute = $this->share->getAttribute($this->path, 'system.dos_attr.mode'); - // parse hex string - $this->modeCache = (int)hexdec(substr($attribute, 2)); - } - return $this->modeCache; - } - - /** - * @return bool - */ - public function isReadOnly() { - $mode = $this->getMode(); - return (bool)($mode & FileInfo::MODE_READONLY); - } - - /** - * @return bool - */ - public function isHidden() { - $mode = $this->getMode(); - return (bool)($mode & FileInfo::MODE_HIDDEN); - } - - /** - * @return bool - */ - public function isSystem() { - $mode = $this->getMode(); - return (bool)($mode & FileInfo::MODE_SYSTEM); - } - - /** - * @return bool - */ - public function isArchived() { - $mode = $this->getMode(); - return (bool)($mode & FileInfo::MODE_ARCHIVE); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeReadStream.php b/apps/files_external/3rdparty/icewind/smb/src/NativeReadStream.php deleted file mode 100644 index 6fd4f5b7f35..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeReadStream.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -/** - * Stream optimized for read only usage - */ -class NativeReadStream extends NativeStream { - const CHUNK_SIZE = 1048576; // 1MB chunks - /** - * @var resource - */ - private $readBuffer = null; - - private $bufferSize = 0; - - private $pos = 0; - - public function stream_open($path, $mode, $options, &$opened_path) { - $this->readBuffer = fopen('php://memory', 'r+'); - - return parent::stream_open($path, $mode, $options, $opened_path); - - } - - /** - * Wrap a stream from libsmbclient-php into a regular php stream - * - * @param \Icewind\SMB\NativeState $state - * @param resource $smbStream - * @param string $mode - * @param string $url - * @return resource - */ - public static function wrap($state, $smbStream, $mode, $url) { - stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeReadStream'); - $context = stream_context_create(array( - 'nativesmb' => array( - 'state' => $state, - 'handle' => $smbStream, - 'url' => $url - ) - )); - $fh = fopen('nativesmb://', $mode, false, $context); - stream_wrapper_unregister('nativesmb'); - return $fh; - } - - public function stream_read($count) { - // php reads 8192 bytes at once - // however due to network latency etc, it's faster to read in larger chunks - // and buffer the result - if (!parent::stream_eof() && $this->bufferSize < $count) { - $remaining = $this->readBuffer; - $this->readBuffer = fopen('php://memory', 'r+'); - $this->bufferSize = 0; - stream_copy_to_stream($remaining, $this->readBuffer); - $this->bufferSize += fwrite($this->readBuffer, parent::stream_read(self::CHUNK_SIZE)); - fseek($this->readBuffer, 0); - } - - $result = fread($this->readBuffer, $count); - $this->bufferSize -= $count; - - $read = strlen($result); - $this->pos += $read; - - return $result; - } - - public function stream_seek($offset, $whence = SEEK_SET) { - $result = parent::stream_seek($offset, $whence); - if ($result) { - $this->readBuffer = fopen('php://memory', 'r+'); - $this->bufferSize = 0; - $this->pos = parent::stream_tell(); - } - return $result; - } - - public function stream_eof() { - return $this->bufferSize <= 0 && parent::stream_eof(); - } - - public function stream_tell() { - return $this->pos; - } - - public function stream_write($data) { - return false; - } - - public function stream_truncate($size) { - return false; - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeServer.php b/apps/files_external/3rdparty/icewind/smb/src/NativeServer.php deleted file mode 100644 index ce8e6d636a9..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeServer.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -class NativeServer extends Server { - /** - * @var \Icewind\SMB\NativeState - */ - protected $state; - - /** - * @param string $host - * @param string $user - * @param string $password - */ - public function __construct($host, $user, $password) { - parent::__construct($host, $user, $password); - $this->state = new NativeState(); - } - - protected function connect() { - $this->state->init($this->getWorkgroup(), $this->getUser(), $this->getPassword()); - } - - /** - * @return \Icewind\SMB\IShare[] - * @throws \Icewind\SMB\Exception\AuthenticationException - * @throws \Icewind\SMB\Exception\InvalidHostException - */ - public function listShares() { - $this->connect(); - $shares = array(); - $dh = $this->state->opendir('smb://' . $this->getHost()); - while ($share = $this->state->readdir($dh)) { - if ($share['type'] === 'file share') { - $shares[] = $this->getShare($share['name']); - } - } - $this->state->closedir($dh); - return $shares; - } - - /** - * @param string $name - * @return \Icewind\SMB\IShare - */ - public function getShare($name) { - return new NativeShare($this, $name); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php b/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php deleted file mode 100644 index 228d9cd7d2e..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php +++ /dev/null @@ -1,305 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\InvalidPathException; -use Icewind\SMB\Exception\InvalidResourceException; - -class NativeShare extends AbstractShare { - /** - * @var Server $server - */ - private $server; - - /** - * @var string $name - */ - private $name; - - /** - * @var \Icewind\SMB\NativeState $state - */ - private $state; - - /** - * @param Server $server - * @param string $name - */ - public function __construct($server, $name) { - parent::__construct(); - $this->server = $server; - $this->name = $name; - $this->state = new NativeState(); - } - - /** - * @throws \Icewind\SMB\Exception\ConnectionException - * @throws \Icewind\SMB\Exception\AuthenticationException - * @throws \Icewind\SMB\Exception\InvalidHostException - */ - protected function connect() { - if ($this->state and $this->state instanceof NativeShare) { - return; - } - - $this->state->init($this->server->getWorkgroup(), $this->server->getUser(), $this->server->getPassword()); - } - - /** - * Get the name of the share - * - * @return string - */ - public function getName() { - return $this->name; - } - - private function buildUrl($path) { - $this->connect(); - $this->verifyPath($path); - $url = sprintf('smb://%s/%s', $this->server->getHost(), $this->name); - if ($path) { - $path = trim($path, '/'); - $url .= '/'; - $url .= implode('/', array_map('rawurlencode', explode('/', $path))); - } - return $url; - } - - /** - * List the content of a remote folder - * - * @param string $path - * @return \Icewind\SMB\IFileInfo[] - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function dir($path) { - $files = array(); - - $dh = $this->state->opendir($this->buildUrl($path)); - while ($file = $this->state->readdir($dh)) { - $name = $file['name']; - if ($name !== '.' and $name !== '..') { - $files [] = new NativeFileInfo($this, $path . '/' . $name, $name); - } - } - - $this->state->closedir($dh); - return $files; - } - - /** - * @param string $path - * @return \Icewind\SMB\IFileInfo - */ - public function stat($path) { - return new NativeFileInfo($this, $path, basename($path), $this->getStat($path)); - } - - public function getStat($path) { - return $this->state->stat($this->buildUrl($path)); - } - - /** - * Create a folder on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\AlreadyExistsException - */ - public function mkdir($path) { - return $this->state->mkdir($this->buildUrl($path)); - } - - /** - * Remove a folder on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function rmdir($path) { - return $this->state->rmdir($this->buildUrl($path)); - } - - /** - * Delete a file on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function del($path) { - return $this->state->unlink($this->buildUrl($path)); - } - - /** - * Rename a remote file - * - * @param string $from - * @param string $to - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\AlreadyExistsException - */ - public function rename($from, $to) { - return $this->state->rename($this->buildUrl($from), $this->buildUrl($to)); - } - - /** - * Upload a local file - * - * @param string $source local file - * @param string $target remove file - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function put($source, $target) { - $sourceHandle = fopen($source, 'rb'); - $targetHandle = $this->state->create($this->buildUrl($target)); - - while ($data = fread($sourceHandle, NativeReadStream::CHUNK_SIZE)) { - $this->state->write($targetHandle, $data); - } - $this->state->close($targetHandle); - return true; - } - - /** - * Download a remote file - * - * @param string $source remove file - * @param string $target local file - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - * @throws \Icewind\SMB\Exception\InvalidPathException - * @throws \Icewind\SMB\Exception\InvalidResourceException - */ - public function get($source, $target) { - if (!$target) { - throw new InvalidPathException('Invalid target path: Filename cannot be empty'); - } - $targetHandle = @fopen($target, 'wb'); - if (!$targetHandle) { - $error = error_get_last(); - if (is_array($error)) { - $reason = $error['message']; - } else { - $reason = 'Unknown error'; - } - throw new InvalidResourceException('Failed opening local file "' . $target . '" for writing: ' . $reason); - } - - $sourceHandle = $this->state->open($this->buildUrl($source), 'r'); - if (!$sourceHandle) { - fclose($targetHandle); - throw new InvalidResourceException('Failed opening remote file "' . $source . '" for reading'); - } - - while ($data = $this->state->read($sourceHandle, NativeReadStream::CHUNK_SIZE)) { - fwrite($targetHandle, $data); - } - $this->state->close($sourceHandle); - return true; - } - - /** - * Open a readable stream top a remote file - * - * @param string $source - * @return resource a read only stream with the contents of the remote file - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function read($source) { - $url = $this->buildUrl($source); - $handle = $this->state->open($url, 'r'); - return NativeReadStream::wrap($this->state, $handle, 'r', $url); - } - - /** - * Open a readable stream top a remote file - * - * @param string $source - * @return resource a read only stream with the contents of the remote file - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function write($source) { - $url = $this->buildUrl($source); - $handle = $this->state->create($url); - return NativeWriteStream::wrap($this->state, $handle, 'w', $url); - } - - /** - * Get extended attributes for the path - * - * @param string $path - * @param string $attribute attribute to get the info - * @return string the attribute value - */ - public function getAttribute($path, $attribute) { - return $this->state->getxattr($this->buildUrl($path), $attribute); - } - - /** - * Get extended attributes for the path - * - * @param string $path - * @param string $attribute attribute to get the info - * @param mixed $value - * @return string the attribute value - */ - public function setAttribute($path, $attribute, $value) { - - if ($attribute === 'system.dos_attr.mode' and is_int($value)) { - $value = '0x' . dechex($value); - } - - return $this->state->setxattr($this->buildUrl($path), $attribute, $value); - } - - /** - * @param string $path - * @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL - * @return mixed - */ - public function setMode($path, $mode) { - return $this->setAttribute($path, 'system.dos_attr.mode', $mode); - } - - /** - * @param string $path - * @return INotifyHandler - */ - public function notify($path) { - // php-smbclient does support notify (https://github.com/eduardok/libsmbclient-php/issues/29) - // so we use the smbclient based backend for this - $share = new Share($this->server, $this->getName()); - return $share->notify($path); - } - - public function __destruct() { - unset($this->state); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeState.php b/apps/files_external/3rdparty/icewind/smb/src/NativeState.php deleted file mode 100644 index 45e0441d252..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeState.php +++ /dev/null @@ -1,295 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\Exception; - -/** - * Low level wrapper for libsmbclient-php for error handling - */ -class NativeState { - /** - * @var resource - */ - protected $state; - - protected $handlerSet = false; - - protected $connected = false; - - // todo replace with static once <5.6 support is dropped - // see error.h - private static $exceptionMap = [ - 1 => '\Icewind\SMB\Exception\ForbiddenException', - 2 => '\Icewind\SMB\Exception\NotFoundException', - 13 => '\Icewind\SMB\Exception\ForbiddenException', - 17 => '\Icewind\SMB\Exception\AlreadyExistsException', - 20 => '\Icewind\SMB\Exception\InvalidTypeException', - 21 => '\Icewind\SMB\Exception\InvalidTypeException', - 28 => '\Icewind\SMB\Exception\OutOfSpaceException', - 39 => '\Icewind\SMB\Exception\NotEmptyException', - 110 => '\Icewind\SMB\Exception\TimedOutException', - 111 => '\Icewind\SMB\Exception\ConnectionRefusedException', - 112 => '\Icewind\SMB\Exception\HostDownException', - 113 => '\Icewind\SMB\Exception\NoRouteToHostException' - ]; - - protected function handleError($path) { - $error = smbclient_state_errno($this->state); - if ($error === 0) { - return; - } - throw Exception::fromMap(self::$exceptionMap, $error, $path); - } - - protected function testResult($result, $uri) { - if ($result === false or $result === null) { - // smb://host/share/path - if (is_string($uri)) { - list(, , , , $path) = explode('/', $uri, 5); - $path = '/' . $path; - } else { - $path = null; - } - $this->handleError($path); - } - } - - /** - * @param string $workGroup - * @param string $user - * @param string $password - * @return bool - */ - public function init($workGroup, $user, $password) { - if ($this->connected) { - return true; - } - $this->state = smbclient_state_new(); - $result = @smbclient_state_init($this->state, $workGroup, $user, $password); - - $this->testResult($result, ''); - $this->connected = true; - return $result; - } - - /** - * @param string $uri - * @return resource - */ - public function opendir($uri) { - $result = @smbclient_opendir($this->state, $uri); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param resource $dir - * @return array - */ - public function readdir($dir) { - $result = @smbclient_readdir($this->state, $dir); - - $this->testResult($result, $dir); - return $result; - } - - /** - * @param $dir - * @return bool - */ - public function closedir($dir) { - $result = smbclient_closedir($this->state, $dir); - - $this->testResult($result, $dir); - return $result; - } - - /** - * @param string $old - * @param string $new - * @return bool - */ - public function rename($old, $new) { - $result = @smbclient_rename($this->state, $old, $this->state, $new); - - $this->testResult($result, $new); - return $result; - } - - /** - * @param string $uri - * @return bool - */ - public function unlink($uri) { - $result = @smbclient_unlink($this->state, $uri); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param string $uri - * @param int $mask - * @return bool - */ - public function mkdir($uri, $mask = 0777) { - $result = @smbclient_mkdir($this->state, $uri, $mask); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param string $uri - * @return bool - */ - public function rmdir($uri) { - $result = @smbclient_rmdir($this->state, $uri); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param string $uri - * @return array - */ - public function stat($uri) { - $result = @smbclient_stat($this->state, $uri); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param resource $file - * @return array - */ - public function fstat($file) { - $result = @smbclient_fstat($this->state, $file); - - $this->testResult($result, $file); - return $result; - } - - /** - * @param string $uri - * @param string $mode - * @param int $mask - * @return resource - */ - public function open($uri, $mode, $mask = 0666) { - $result = @smbclient_open($this->state, $uri, $mode, $mask); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param string $uri - * @param int $mask - * @return resource - */ - public function create($uri, $mask = 0666) { - $result = @smbclient_creat($this->state, $uri, $mask); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param resource $file - * @param int $bytes - * @return string - */ - public function read($file, $bytes) { - $result = @smbclient_read($this->state, $file, $bytes); - - $this->testResult($result, $file); - return $result; - } - - /** - * @param resource $file - * @param string $data - * @param int $length - * @return int - */ - public function write($file, $data, $length = null) { - $result = @smbclient_write($this->state, $file, $data, $length); - - $this->testResult($result, $file); - return $result; - } - - /** - * @param resource $file - * @param int $offset - * @param int $whence SEEK_SET | SEEK_CUR | SEEK_END - * @return int|bool new file offset as measured from the start of the file on success, false on failure. - */ - public function lseek($file, $offset, $whence = SEEK_SET) { - $result = @smbclient_lseek($this->state, $file, $offset, $whence); - - $this->testResult($result, $file); - return $result; - } - - /** - * @param resource $file - * @param int $size - * @return bool - */ - public function ftruncate($file, $size) { - $result = @smbclient_ftruncate($this->state, $file, $size); - - $this->testResult($result, $file); - return $result; - } - - public function close($file) { - $result = @smbclient_close($this->state, $file); - - $this->testResult($result, $file); - return $result; - } - - /** - * @param string $uri - * @param string $key - * @return string - */ - public function getxattr($uri, $key) { - $result = @smbclient_getxattr($this->state, $uri, $key); - - $this->testResult($result, $uri); - return $result; - } - - /** - * @param string $uri - * @param string $key - * @param string $value - * @param int $flags - * @return mixed - */ - public function setxattr($uri, $key, $value, $flags = 0) { - $result = @smbclient_setxattr($this->state, $uri, $key, $value, $flags); - - $this->testResult($result, $uri); - return $result; - } - - public function __destruct() { - if ($this->connected) { - smbclient_state_free($this->state); - } - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeStream.php b/apps/files_external/3rdparty/icewind/smb/src/NativeStream.php deleted file mode 100644 index bce72001b5a..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeStream.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\Exception; -use Icewind\SMB\Exception\InvalidRequestException; -use Icewind\Streams\File; - -class NativeStream implements File { - /** - * @var resource - */ - public $context; - - /** - * @var \Icewind\SMB\NativeState - */ - protected $state; - - /** - * @var resource - */ - protected $handle; - - /** - * @var bool - */ - protected $eof = false; - - /** - * @var string - */ - protected $url; - - /** - * Wrap a stream from libsmbclient-php into a regular php stream - * - * @param \Icewind\SMB\NativeState $state - * @param resource $smbStream - * @param string $mode - * @param string $url - * @return resource - */ - public static function wrap($state, $smbStream, $mode, $url) { - stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeStream'); - $context = stream_context_create(array( - 'nativesmb' => array( - 'state' => $state, - 'handle' => $smbStream, - 'url' => $url - ) - )); - $fh = fopen('nativesmb://', $mode, false, $context); - stream_wrapper_unregister('nativesmb'); - return $fh; - } - - public function stream_close() { - return $this->state->close($this->handle); - } - - public function stream_eof() { - return $this->eof; - } - - public function stream_flush() { - } - - - public function stream_open($path, $mode, $options, &$opened_path) { - $context = stream_context_get_options($this->context); - $this->state = $context['nativesmb']['state']; - $this->handle = $context['nativesmb']['handle']; - $this->url = $context['nativesmb']['url']; - return true; - } - - public function stream_read($count) { - $result = $this->state->read($this->handle, $count); - if (strlen($result) < $count) { - $this->eof = true; - } - return $result; - } - - public function stream_seek($offset, $whence = SEEK_SET) { - $this->eof = false; - try { - return $this->state->lseek($this->handle, $offset, $whence) !== false; - } catch (InvalidRequestException $e) { - return false; - } - } - - public function stream_stat() { - try { - return $this->state->stat($this->url); - } catch (Exception $e) { - return false; - } - } - - public function stream_tell() { - return $this->state->lseek($this->handle, 0, SEEK_CUR); - } - - public function stream_write($data) { - return $this->state->write($this->handle, $data); - } - - public function stream_truncate($size) { - return $this->state->ftruncate($this->handle, $size); - } - - public function stream_set_option($option, $arg1, $arg2) { - return false; - } - - public function stream_lock($operation) { - return false; - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeWriteStream.php b/apps/files_external/3rdparty/icewind/smb/src/NativeWriteStream.php deleted file mode 100644 index 69a270f160f..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeWriteStream.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -/** - * Stream optimized for write only usage - */ -class NativeWriteStream extends NativeStream { - const CHUNK_SIZE = 1048576; // 1MB chunks - /** - * @var resource - */ - private $writeBuffer = null; - - private $bufferSize = 0; - - private $pos = 0; - - public function stream_open($path, $mode, $options, &$opened_path) { - $this->writeBuffer = fopen('php://memory', 'r+'); - - return parent::stream_open($path, $mode, $options, $opened_path); - - } - - /** - * Wrap a stream from libsmbclient-php into a regular php stream - * - * @param \Icewind\SMB\NativeState $state - * @param resource $smbStream - * @param string $mode - * @param string $url - * @return resource - */ - public static function wrap($state, $smbStream, $mode, $url) { - stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeWriteStream'); - $context = stream_context_create(array( - 'nativesmb' => array( - 'state' => $state, - 'handle' => $smbStream, - 'url' => $url - ) - )); - $fh = fopen('nativesmb://', $mode, false, $context); - stream_wrapper_unregister('nativesmb'); - return $fh; - } - - public function stream_seek($offset, $whence = SEEK_SET) { - $this->flushWrite(); - $result = parent::stream_seek($offset, $whence); - if ($result) { - $this->pos = parent::stream_tell(); - } - return $result; - } - - private function flushWrite() { - rewind($this->writeBuffer); - $this->state->write($this->handle, stream_get_contents($this->writeBuffer)); - $this->writeBuffer = fopen('php://memory', 'r+'); - $this->bufferSize = 0; - } - - public function stream_write($data) { - $written = fwrite($this->writeBuffer, $data); - $this->bufferSize += $written; - $this->pos += $written; - - if ($this->bufferSize >= self::CHUNK_SIZE) { - $this->flushWrite(); - } - - return $written; - } - - public function stream_close() { - $this->flushWrite(); - return parent::stream_close(); - } - - public function stream_tell() { - return $this->pos; - } - - public function stream_read($count) { - return false; - } - - public function stream_truncate($size) { - $this->flushWrite(); - $this->pos = $size; - return parent::stream_truncate($size); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/NotifyHandler.php b/apps/files_external/3rdparty/icewind/smb/src/NotifyHandler.php deleted file mode 100644 index 20ada5cf320..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/NotifyHandler.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016 Robin Appelman <robin@icewind.nl> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - * - */ - -namespace Icewind\SMB; - - -use Icewind\SMB\Exception\Exception; - -class NotifyHandler implements INotifyHandler { - /** - * @var Connection - */ - private $connection; - - /** - * @var string - */ - private $path; - - private $listening = true; - - // todo replace with static once <5.6 support is dropped - // see error.h - private static $exceptionMap = [ - ErrorCodes::RevisionMismatch => '\Icewind\SMB\Exception\RevisionMismatchException', - ]; - - /** - * @param Connection $connection - * @param string $path - */ - public function __construct(Connection $connection, $path) { - $this->connection = $connection; - $this->path = $path; - } - - /** - * Get all changes detected since the start of the notify process or the last call to getChanges - * - * @return Change[] - */ - public function getChanges() { - if (!$this->listening) { - return []; - } - stream_set_blocking($this->connection->getOutputStream(), 0); - $lines = []; - while (($line = $this->connection->readLine())) { - $this->checkForError($line); - $lines[] = $line; - } - stream_set_blocking($this->connection->getOutputStream(), 1); - return array_values(array_filter(array_map([$this, 'parseChangeLine'], $lines))); - } - - /** - * Listen actively to all incoming changes - * - * Note that this is a blocking process and will cause the process to block forever if not explicitly terminated - * - * @param callable $callback - */ - public function listen($callback) { - if ($this->listening) { - $this->connection->read(function ($line) use ($callback) { - $this->checkForError($line); - $change = $this->parseChangeLine($line); - if ($change) { - return $callback($change); - } - }); - } - } - - private function parseChangeLine($line) { - $code = (int)substr($line, 0, 4); - if ($code === 0) { - return null; - } - $subPath = str_replace('\\', '/', substr($line, 5)); - if ($this->path === '') { - return new Change($code, $subPath); - } else { - return new Change($code, $this->path . '/' . $subPath); - } - } - - private function checkForError($line) { - if (substr($line, 0, 16) === 'notify returned ') { - $error = substr($line, 16); - throw Exception::fromMap(self::$exceptionMap, $error, 'Notify is not supported with the used smb version'); - } - } - - public function stop() { - $this->listening = false; - $this->connection->close(); - } - - public function __destruct() { - $this->stop(); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Parser.php b/apps/files_external/3rdparty/icewind/smb/src/Parser.php deleted file mode 100644 index 3142f9c29e0..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Parser.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\AccessDeniedException; -use Icewind\SMB\Exception\AlreadyExistsException; -use Icewind\SMB\Exception\AuthenticationException; -use Icewind\SMB\Exception\Exception; -use Icewind\SMB\Exception\FileInUseException; -use Icewind\SMB\Exception\InvalidHostException; -use Icewind\SMB\Exception\InvalidResourceException; -use Icewind\SMB\Exception\InvalidTypeException; -use Icewind\SMB\Exception\NoLoginServerException; -use Icewind\SMB\Exception\NotEmptyException; -use Icewind\SMB\Exception\NotFoundException; - -class Parser { - const MSG_NOT_FOUND = 'Error opening local file '; - - /** - * @var \Icewind\SMB\TimeZoneProvider - */ - protected $timeZoneProvider; - - // todo replace with static once <5.6 support is dropped - // see error.h - private static $exceptionMap = [ - ErrorCodes::LogonFailure => '\Icewind\SMB\Exception\AuthenticationException', - ErrorCodes::PathNotFound => '\Icewind\SMB\Exception\NotFoundException', - ErrorCodes::ObjectNotFound => '\Icewind\SMB\Exception\NotFoundException', - ErrorCodes::NoSuchFile => '\Icewind\SMB\Exception\NotFoundException', - ErrorCodes::NameCollision => '\Icewind\SMB\Exception\AlreadyExistsException', - ErrorCodes::AccessDenied => '\Icewind\SMB\Exception\AccessDeniedException', - ErrorCodes::DirectoryNotEmpty => '\Icewind\SMB\Exception\NotEmptyException', - ErrorCodes::FileIsADirectory => '\Icewind\SMB\Exception\InvalidTypeException', - ErrorCodes::NotADirectory => '\Icewind\SMB\Exception\InvalidTypeException', - ErrorCodes::SharingViolation => '\Icewind\SMB\Exception\FileInUseException', - ErrorCodes::InvalidParameter => '\Icewind\SMB\Exception\InvalidParameterException' - ]; - - /** - * @param \Icewind\SMB\TimeZoneProvider $timeZoneProvider - */ - public function __construct(TimeZoneProvider $timeZoneProvider) { - $this->timeZoneProvider = $timeZoneProvider; - } - - private function getErrorCode($line) { - $parts = explode(' ', $line); - foreach ($parts as $part) { - if (substr($part, 0, 9) === 'NT_STATUS') { - return $part; - } - } - return false; - } - - public function checkForError($output, $path) { - if (strpos($output[0], 'does not exist')) { - throw new NotFoundException($path); - } - $error = $this->getErrorCode($output[0]); - - if (substr($output[0], 0, strlen(self::MSG_NOT_FOUND)) === self::MSG_NOT_FOUND) { - $localPath = substr($output[0], strlen(self::MSG_NOT_FOUND)); - throw new InvalidResourceException('Failed opening local file "' . $localPath . '" for writing'); - } - - throw Exception::fromMap(self::$exceptionMap, $error, $path); - } - - /** - * check if the first line holds a connection failure - * - * @param $line - * @throws AuthenticationException - * @throws InvalidHostException - * @throws NoLoginServerException - */ - public function checkConnectionError($line) { - $line = rtrim($line, ')'); - if (substr($line, -23) === ErrorCodes::LogonFailure) { - throw new AuthenticationException('Invalid login'); - } - if (substr($line, -26) === ErrorCodes::BadHostName) { - throw new InvalidHostException('Invalid hostname'); - } - if (substr($line, -22) === ErrorCodes::Unsuccessful) { - throw new InvalidHostException('Connection unsuccessful'); - } - if (substr($line, -28) === ErrorCodes::ConnectionRefused) { - throw new InvalidHostException('Connection refused'); - } - if (substr($line, -26) === ErrorCodes::NoLogonServers) { - throw new NoLoginServerException('No login server'); - } - } - - public function parseMode($mode) { - $result = 0; - $modeStrings = array( - 'R' => FileInfo::MODE_READONLY, - 'H' => FileInfo::MODE_HIDDEN, - 'S' => FileInfo::MODE_SYSTEM, - 'D' => FileInfo::MODE_DIRECTORY, - 'A' => FileInfo::MODE_ARCHIVE, - 'N' => FileInfo::MODE_NORMAL - ); - foreach ($modeStrings as $char => $val) { - if (strpos($mode, $char) !== false) { - $result |= $val; - } - } - return $result; - } - - public function parseStat($output) { - $data = []; - foreach ($output as $line) { - // A line = explode statement may not fill all array elements - // properly. May happen when accessing non Windows Fileservers - $words = explode(':', $line, 2); - $name = isset($words[0]) ? $words[0] : ''; - $value = isset($words[1]) ? $words[1] : ''; - $value = trim($value); - $data[$name] = $value; - } - return [ - 'mtime' => strtotime($data['write_time']), - 'mode' => hexdec(substr($data['attributes'], strpos($data['attributes'], '('), -1)), - 'size' => isset($data['stream']) ? intval(explode(' ', $data['stream'])[1]) : 0 - ]; - } - - public function parseDir($output, $basePath) { - //last line is used space - array_pop($output); - $regex = '/^\s*(.*?)\s\s\s\s+(?:([NDHARS]*)\s+)?([0-9]+)\s+(.*)$/'; - //2 spaces, filename, optional type, size, date - $content = array(); - foreach ($output as $line) { - if (preg_match($regex, $line, $matches)) { - list(, $name, $mode, $size, $time) = $matches; - if ($name !== '.' and $name !== '..') { - $mode = $this->parseMode($mode); - $time = strtotime($time . ' ' . $this->timeZoneProvider->get()); - $content[] = new FileInfo($basePath . '/' . $name, $name, $size, $time, $mode); - } - } - } - return $content; - } - - public function parseListShares($output) { - $shareNames = array(); - foreach ($output as $line) { - if (strpos($line, '|')) { - list($type, $name, $description) = explode('|', $line); - if (strtolower($type) === 'disk') { - $shareNames[$name] = $description; - } - } - } - return $shareNames; - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/RawConnection.php b/apps/files_external/3rdparty/icewind/smb/src/RawConnection.php deleted file mode 100644 index 42923f09eda..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/RawConnection.php +++ /dev/null @@ -1,198 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\ConnectException; -use Icewind\SMB\Exception\ConnectionException; - -class RawConnection { - /** - * @var string - */ - private $command; - - /** - * @var string[] - */ - private $env; - - /** - * @var resource[] $pipes - * - * $pipes[0] holds STDIN for smbclient - * $pipes[1] holds STDOUT for smbclient - * $pipes[3] holds the authfile for smbclient - * $pipes[4] holds the stream for writing files - * $pipes[5] holds the stream for reading files - */ - private $pipes; - - /** - * @var resource $process - */ - private $process; - - /** - * @var resource|null $authStream - */ - private $authStream = null; - - private $connected = false; - - public function __construct($command, array $env = []) { - $this->command = $command; - $this->env = $env; - } - - public function connect() { - if (is_null($this->getAuthStream())) { - throw new ConnectException('Authentication not set before connecting'); - } - - $descriptorSpec = [ - 0 => ['pipe', 'r'], // child reads from stdin - 1 => ['pipe', 'w'], // child writes to stdout - 2 => ['pipe', 'w'], // child writes to stderr - 3 => $this->getAuthStream(), // child reads from fd#3 - 4 => ['pipe', 'r'], // child reads from fd#4 - 5 => ['pipe', 'w'] // child writes to fd#5 - ]; - - setlocale(LC_ALL, Server::LOCALE); - $env = array_merge($this->env, [ - 'CLI_FORCE_INTERACTIVE' => 'y', // Needed or the prompt isn't displayed!! - 'LC_ALL' => Server::LOCALE, - 'LANG' => Server::LOCALE, - 'COLUMNS' => 8192 // prevent smbclient from line-wrapping it's output - ]); - $this->process = proc_open($this->command, $descriptorSpec, $this->pipes, '/', $env); - if (!$this->isValid()) { - throw new ConnectionException(); - } - $this->connected = true; - } - - /** - * check if the connection is still active - * - * @return bool - */ - public function isValid() { - if (is_resource($this->process)) { - $status = proc_get_status($this->process); - return $status['running']; - } else { - return false; - } - } - - /** - * send input to the process - * - * @param string $input - */ - public function write($input) { - fwrite($this->getInputStream(), $input); - fflush($this->getInputStream()); - } - - /** - * read a line of output - * - * @return string|false - */ - public function readLine() { - return stream_get_line($this->getOutputStream(), 4086, "\n"); - } - - /** - * read a line of output - * - * @return string - */ - public function readError() { - return trim(stream_get_line($this->getErrorStream(), 4086)); - } - - /** - * get all output until the process closes - * - * @return array - */ - public function readAll() { - $output = array(); - while ($line = $this->readLine()) { - $output[] = $line; - } - return $output; - } - - public function getInputStream() { - return $this->pipes[0]; - } - - public function getOutputStream() { - return $this->pipes[1]; - } - - public function getErrorStream() { - return $this->pipes[2]; - } - - public function getAuthStream() { - return $this->authStream; - } - - public function getFileInputStream() { - return $this->pipes[4]; - } - - public function getFileOutputStream() { - return $this->pipes[5]; - } - - public function writeAuthentication($user, $password) { - $auth = ($password === false) - ? "username=$user" - : "username=$user\npassword=$password\n"; - - $this->authStream = fopen('php://temp', 'w+'); - fwrite($this->getAuthStream(), $auth); - } - - public function close($terminate = true) { - if (!is_resource($this->process)) { - return; - } - if ($terminate) { - // if for case that posix_ functions are not available - if (function_exists('posix_kill')) { - $status = proc_get_status($this->process); - $ppid = $status['pid']; - $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`); - foreach ($pids as $pid) { - if (is_numeric($pid)) { - //9 is the SIGKILL signal - posix_kill($pid, 9); - } - } - } - proc_terminate($this->process); - } - proc_close($this->process); - } - - public function reconnect() { - $this->close(); - $this->connect(); - } - - public function __destruct() { - $this->close(); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Server.php b/apps/files_external/3rdparty/icewind/smb/src/Server.php deleted file mode 100644 index 21cc605ed1f..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Server.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\AuthenticationException; -use Icewind\SMB\Exception\InvalidHostException; - -class Server { - const LOCALE = 'en_US.UTF-8'; - - /** - * @var string $host - */ - protected $host; - - /** - * @var string $user - */ - protected $user; - - /** - * @var string $password - */ - protected $password; - - /** - * @var string $workgroup - */ - protected $workgroup; - - /** - * @var \Icewind\SMB\System - */ - private $system; - - /** - * @var TimeZoneProvider - */ - private $timezoneProvider; - - /** - * Check if the smbclient php extension is available - * - * @return bool - */ - public static function NativeAvailable() { - return function_exists('smbclient_state_new'); - } - - /** - * @param string $host - * @param string $user - * @param string $password - */ - public function __construct($host, $user, $password) { - $this->host = $host; - list($workgroup, $user) = $this->splitUser($user); - $this->user = $user; - $this->workgroup = $workgroup; - $this->password = $password; - $this->system = new System(); - $this->timezoneProvider = new TimeZoneProvider($host, $this->system); - } - - /** - * Split workgroup from username - * - * @param $user - * @return string[] [$workgroup, $user] - */ - public function splitUser($user) { - if (strpos($user, '/')) { - return explode('/', $user, 2); - } elseif (strpos($user, '\\')) { - return explode('\\', $user); - } else { - return array(null, $user); - } - } - - /** - * @return string - */ - public function getAuthString() { - return $this->user . '%' . $this->password; - } - - /** - * @return string - */ - public function getUser() { - return $this->user; - } - - /** - * @return string - */ - public function getPassword() { - return $this->password; - } - - /** - * return string - */ - public function getHost() { - return $this->host; - } - - /** - * @return string - */ - public function getWorkgroup() { - return $this->workgroup; - } - - /** - * @return \Icewind\SMB\IShare[] - * - * @throws \Icewind\SMB\Exception\AuthenticationException - * @throws \Icewind\SMB\Exception\InvalidHostException - */ - public function listShares() { - $workgroupArgument = ($this->workgroup) ? ' -W ' . escapeshellarg($this->workgroup) : ''; - $command = sprintf('%s %s --authentication-file=%s -gL %s', - $this->system->getSmbclientPath(), - $workgroupArgument, - System::getFD(3), - escapeshellarg($this->getHost()) - ); - $connection = new RawConnection($command); - $connection->writeAuthentication($this->getUser(), $this->getPassword()); - $connection->connect(); - $output = $connection->readAll(); - $parser = new Parser($this->timezoneProvider); - - $parser->checkConnectionError($output[0]); - - $shareNames = $parser->parseListShares($output); - - $shares = array(); - foreach ($shareNames as $name => $description) { - $shares[] = $this->getShare($name); - } - return $shares; - } - - /** - * @param string $name - * @return \Icewind\SMB\IShare - */ - public function getShare($name) { - return new Share($this, $name, $this->system); - } - - /** - * @return string - */ - public function getTimeZone() { - return $this->timezoneProvider->get(); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Share.php deleted file mode 100644 index 542eaf0887e..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/Share.php +++ /dev/null @@ -1,432 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\ConnectionException; -use Icewind\SMB\Exception\DependencyException; -use Icewind\SMB\Exception\FileInUseException; -use Icewind\SMB\Exception\InvalidTypeException; -use Icewind\SMB\Exception\NotFoundException; -use Icewind\Streams\CallbackWrapper; - -class Share extends AbstractShare { - /** - * @var Server $server - */ - private $server; - - /** - * @var string $name - */ - private $name; - - /** - * @var Connection $connection - */ - public $connection; - - /** - * @var \Icewind\SMB\Parser - */ - protected $parser; - - /** - * @var \Icewind\SMB\System - */ - private $system; - - /** - * @param Server $server - * @param string $name - * @param System $system - */ - public function __construct($server, $name, System $system = null) { - parent::__construct(); - $this->server = $server; - $this->name = $name; - $this->system = (!is_null($system)) ? $system : new System(); - $this->parser = new Parser(new TimeZoneProvider($this->server->getHost(), $this->system)); - } - - protected function getConnection() { - $workgroupArgument = ($this->server->getWorkgroup()) ? ' -W ' . escapeshellarg($this->server->getWorkgroup()) : ''; - $smbClientPath = $this->system->getSmbclientPath(); - if (!$smbClientPath) { - throw new DependencyException('Can\'t find smbclient binary in path'); - } - $command = sprintf('%s%s %s --authentication-file=%s %s', - $this->system->hasStdBuf() ? 'stdbuf -o0 ' : '', - $this->system->getSmbclientPath(), - $workgroupArgument, - System::getFD(3), - escapeshellarg('//' . $this->server->getHost() . '/' . $this->name) - ); - $connection = new Connection($command, $this->parser); - $connection->writeAuthentication($this->server->getUser(), $this->server->getPassword()); - $connection->connect(); - if (!$connection->isValid()) { - throw new ConnectionException($connection->readLine()); - } - return $connection; - } - - /** - * @throws \Icewind\SMB\Exception\ConnectionException - * @throws \Icewind\SMB\Exception\AuthenticationException - * @throws \Icewind\SMB\Exception\InvalidHostException - */ - protected function connect() { - if ($this->connection and $this->connection->isValid()) { - return; - } - $this->connection = $this->getConnection(); - } - - protected function reconnect() { - $this->connection->reconnect(); - if (!$this->connection->isValid()) { - throw new ConnectionException(); - } - } - - /** - * Get the name of the share - * - * @return string - */ - public function getName() { - return $this->name; - } - - protected function simpleCommand($command, $path) { - $escapedPath = $this->escapePath($path); - $cmd = $command . ' ' . $escapedPath; - $output = $this->execute($cmd); - return $this->parseOutput($output, $path); - } - - /** - * List the content of a remote folder - * - * @param $path - * @return \Icewind\SMB\IFileInfo[] - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function dir($path) { - $escapedPath = $this->escapePath($path); - $output = $this->execute('cd ' . $escapedPath); - //check output for errors - $this->parseOutput($output, $path); - $output = $this->execute('dir'); - $this->execute('cd /'); - - return $this->parser->parseDir($output, $path); - } - - /** - * @param string $path - * @return \Icewind\SMB\IFileInfo - */ - public function stat($path) { - $escapedPath = $this->escapePath($path); - $output = $this->execute('allinfo ' . $escapedPath); - // Windows and non Windows Fileserver may respond different - // to the allinfo command for directories. If the result is a single - // line = error line, redo it with a different allinfo parameter - if ($escapedPath == '""' && count($output) < 2) { - $output = $this->execute('allinfo ' . '"."'); - } - if (count($output) < 3) { - $this->parseOutput($output, $path); - } - $stat = $this->parser->parseStat($output); - return new FileInfo($path, basename($path), $stat['size'], $stat['mtime'], $stat['mode']); - } - - /** - * Create a folder on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\AlreadyExistsException - */ - public function mkdir($path) { - return $this->simpleCommand('mkdir', $path); - } - - /** - * Remove a folder on the share - * - * @param string $path - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function rmdir($path) { - return $this->simpleCommand('rmdir', $path); - } - - /** - * Delete a file on the share - * - * @param string $path - * @param bool $secondTry - * @return bool - * @throws InvalidTypeException - * @throws NotFoundException - * @throws \Exception - */ - public function del($path, $secondTry = false) { - //del return a file not found error when trying to delete a folder - //we catch it so we can check if $path doesn't exist or is of invalid type - try { - return $this->simpleCommand('del', $path); - } catch (NotFoundException $e) { - //no need to do anything with the result, we just check if this throws the not found error - try { - $this->simpleCommand('ls', $path); - } catch (NotFoundException $e2) { - throw $e; - } catch (\Exception $e2) { - throw new InvalidTypeException($path); - } - throw $e; - } catch (FileInUseException $e) { - if ($secondTry) { - throw $e; - } - $this->reconnect(); - return $this->del($path, true); - } - } - - /** - * Rename a remote file - * - * @param string $from - * @param string $to - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\AlreadyExistsException - */ - public function rename($from, $to) { - $path1 = $this->escapePath($from); - $path2 = $this->escapePath($to); - $output = $this->execute('rename ' . $path1 . ' ' . $path2); - return $this->parseOutput($output, $to); - } - - /** - * Upload a local file - * - * @param string $source local file - * @param string $target remove file - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function put($source, $target) { - $path1 = $this->escapeLocalPath($source); //first path is local, needs different escaping - $path2 = $this->escapePath($target); - $output = $this->execute('put ' . $path1 . ' ' . $path2); - return $this->parseOutput($output, $target); - } - - /** - * Download a remote file - * - * @param string $source remove file - * @param string $target local file - * @return bool - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function get($source, $target) { - $path1 = $this->escapePath($source); - $path2 = $this->escapeLocalPath($target); //second path is local, needs different escaping - $output = $this->execute('get ' . $path1 . ' ' . $path2); - return $this->parseOutput($output, $source); - } - - /** - * Open a readable stream to a remote file - * - * @param string $source - * @return resource a read only stream with the contents of the remote file - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function read($source) { - $source = $this->escapePath($source); - // since returned stream is closed by the caller we need to create a new instance - // since we can't re-use the same file descriptor over multiple calls - $connection = $this->getConnection(); - - $connection->write('get ' . $source . ' ' . System::getFD(5)); - $connection->write('exit'); - $fh = $connection->getFileOutputStream(); - stream_context_set_option($fh, 'file', 'connection', $connection); - return $fh; - } - - /** - * Open a writable stream to a remote file - * - * @param string $target - * @return resource a write only stream to upload a remote file - * - * @throws \Icewind\SMB\Exception\NotFoundException - * @throws \Icewind\SMB\Exception\InvalidTypeException - */ - public function write($target) { - $target = $this->escapePath($target); - // since returned stream is closed by the caller we need to create a new instance - // since we can't re-use the same file descriptor over multiple calls - $connection = $this->getConnection(); - - $fh = $connection->getFileInputStream(); - $connection->write('put ' . System::getFD(4) . ' ' . $target); - $connection->write('exit'); - - // use a close callback to ensure the upload is finished before continuing - // this also serves as a way to keep the connection in scope - return CallbackWrapper::wrap($fh, null, null, function () use ($connection, $target) { - $connection->close(false); // dont terminate, give the upload some time - }); - } - - /** - * @param string $path - * @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL - * @return mixed - */ - public function setMode($path, $mode) { - $modeString = ''; - $modeMap = array( - FileInfo::MODE_READONLY => 'r', - FileInfo::MODE_HIDDEN => 'h', - FileInfo::MODE_ARCHIVE => 'a', - FileInfo::MODE_SYSTEM => 's' - ); - foreach ($modeMap as $modeByte => $string) { - if ($mode & $modeByte) { - $modeString .= $string; - } - } - $path = $this->escapePath($path); - - // first reset the mode to normal - $cmd = 'setmode ' . $path . ' -rsha'; - $output = $this->execute($cmd); - $this->parseOutput($output, $path); - - if ($mode !== FileInfo::MODE_NORMAL) { - // then set the modes we want - $cmd = 'setmode ' . $path . ' ' . $modeString; - $output = $this->execute($cmd); - return $this->parseOutput($output, $path); - } else { - return true; - } - } - - /** - * @param string $path - * @return INotifyHandler - * @throws ConnectionException - * @throws DependencyException - */ - public function notify($path) { - if (!$this->system->hasStdBuf()) { //stdbuf is required to disable smbclient's output buffering - throw new DependencyException('stdbuf is required for usage of the notify command'); - } - $connection = $this->getConnection(); // use a fresh connection since the notify command blocks the process - $command = 'notify ' . $this->escapePath($path); - $connection->write($command . PHP_EOL); - return new NotifyHandler($connection, $path); - } - - /** - * @param string $command - * @return array - */ - protected function execute($command) { - $this->connect(); - $this->connection->write($command . PHP_EOL); - $output = $this->connection->read(); - return $output; - } - - /** - * check output for errors - * - * @param string[] $lines - * @param string $path - * - * @throws NotFoundException - * @throws \Icewind\SMB\Exception\AlreadyExistsException - * @throws \Icewind\SMB\Exception\AccessDeniedException - * @throws \Icewind\SMB\Exception\NotEmptyException - * @throws \Icewind\SMB\Exception\InvalidTypeException - * @throws \Icewind\SMB\Exception\Exception - * @return bool - */ - protected function parseOutput($lines, $path = '') { - if (count($lines) === 0) { - return true; - } else { - $this->parser->checkForError($lines, $path); - return false; - } - } - - /** - * @param string $string - * @return string - */ - protected function escape($string) { - return escapeshellarg($string); - } - - /** - * @param string $path - * @return string - */ - protected function escapePath($path) { - $this->verifyPath($path); - if ($path === '/') { - $path = ''; - } - $path = str_replace('/', '\\', $path); - $path = str_replace('"', '^"', $path); - $path = ltrim($path, '\\'); - return '"' . $path . '"'; - } - - /** - * @param string $path - * @return string - */ - protected function escapeLocalPath($path) { - $path = str_replace('"', '\"', $path); - return '"' . $path . '"'; - } - - public function __destruct() { - unset($this->connection); - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/System.php b/apps/files_external/3rdparty/icewind/smb/src/System.php deleted file mode 100644 index 7c519988aa5..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/System.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -use Icewind\SMB\Exception\Exception; - -class System { - private $smbclient; - - private $net; - - private $stdbuf; - - public static function getFD($num) { - $folders = array( - '/proc/self/fd', - '/dev/fd' - ); - foreach ($folders as $folder) { - if (file_exists($folder)) { - return $folder . '/' . $num; - } - } - throw new Exception('Cant find file descriptor path'); - } - - public function getSmbclientPath() { - if (!$this->smbclient) { - $this->smbclient = trim(`which smbclient`); - } - return $this->smbclient; - } - - public function getNetPath() { - if (!$this->net) { - $this->net = trim(`which net`); - } - return $this->net; - } - - public function hasStdBuf() { - if (!$this->stdbuf) { - $result = null; - $output = array(); - exec('which stdbuf 2>&1', $output, $result); - $this->stdbuf = $result === 0; - } - return $this->stdbuf; - } -} diff --git a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php deleted file mode 100644 index fcdf7e3e879..00000000000 --- a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\SMB; - -class TimeZoneProvider { - /** - * @var string - */ - private $host; - - /** - * @var string - */ - private $timeZone; - - /** - * @var System - */ - private $system; - - /** - * @param string $host - * @param System $system - */ - public function __construct($host, System $system) { - $this->host = $host; - $this->system = $system; - } - - public function get() { - if (!$this->timeZone) { - $net = $this->system->getNetPath(); - if ($net) { - $command = sprintf('%s time zone -S %s', - $net, - escapeshellarg($this->host) - ); - $this->timeZone = exec($command); - } else { // fallback to server timezone - $this->timeZone = date_default_timezone_get(); - } - } - return $this->timeZone; - } -} diff --git a/apps/files_external/3rdparty/icewind/streams-dummy/composer.json b/apps/files_external/3rdparty/icewind/streams-dummy/composer.json deleted file mode 100644 index ad6a6a1b1c1..00000000000 --- a/apps/files_external/3rdparty/icewind/streams-dummy/composer.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "icewind/streams-dummy", - "provide": { - "icewind/streams": "0.2" - } -} - diff --git a/apps/files_external/3rdparty/icewind/streams/.gitignore b/apps/files_external/3rdparty/icewind/streams/.gitignore deleted file mode 100644 index 4f389129e2d..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.idea -vendor -composer.lock diff --git a/apps/files_external/3rdparty/icewind/streams/.travis.yml b/apps/files_external/3rdparty/icewind/streams/.travis.yml deleted file mode 100644 index d2e1afaad67..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: php -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm - -matrix: - allow_failures: - - php: hhvm # due to facebook/hhvm#3321 - -env: - global: - - CURRENT_DIR=`pwd` - -install: - - composer install --dev --no-interaction - -script: - - mkdir -p build/logs - - cd tests - - phpunit --coverage-clover ../build/logs/clover.xml --configuration phpunit.xml - -after_script: - - cd $CURRENT_DIR - - php vendor/bin/coveralls -v diff --git a/apps/files_external/3rdparty/icewind/streams/LICENCE b/apps/files_external/3rdparty/icewind/streams/LICENCE deleted file mode 100644 index a194b9117b8..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/LICENCE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Robin Appelman - -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/icewind/streams/README.md b/apps/files_external/3rdparty/icewind/streams/README.md deleted file mode 100644 index ca13db28e44..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/README.md +++ /dev/null @@ -1,53 +0,0 @@ -#Streams# - -[](https://travis-ci.org/icewind1991/Streams) -[](https://coveralls.io/r/icewind1991/Streams?branch=master) -[](https://scrutinizer-ci.com/g/icewind1991/Streams/?branch=master) - -Generic stream wrappers for php. - -##CallBackWrapper## - -A `CallBackWrapper` can be used to register callbacks on read, write and closing of the stream, -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### -```php -<?php - -use \Icewind\Streams\CallBackWrapper; - -require('vendor/autoload.php'); - -// get an existing stream to wrap -$source = fopen('php://temp', 'r+'); - -// register the callbacks -$stream = CallbackWrapper::wrap($source, - // read callback - function ($count) { - echo "read " . $count . "bytes\n"; - }, - // write callback - function ($data) { - echo "wrote '" . $data . "'\n"; - }, - // close callback - function () { - echo "stream closed\n"; - }); - -fwrite($stream, 'some dummy data'); - -rewind($stream); -fread($stream, 5); - -fclose($stream); -``` - -Note: due to php's internal stream buffering the `$count` passed to the read callback -will be equal to php's internal buffer size (8192 on default) an not the number of bytes -requested by `fopen()` diff --git a/apps/files_external/3rdparty/icewind/streams/composer.json b/apps/files_external/3rdparty/icewind/streams/composer.json deleted file mode 100644 index f2f3e0fc255..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name" : "icewind/streams", - "description" : "A set of generic stream wrappers", - "license" : "MIT", - "authors" : [ - { - "name" : "Robin Appelman", - "email": "icewind@owncloud.com" - } - ], - "require" : { - "php": ">=5.3" - }, - "require-dev" : { - "satooshi/php-coveralls": "v1.0.0", - "phpunit/phpunit": "^4.8" - }, - "autoload" : { - "psr-4": { - "Icewind\\Streams\\Tests\\": "tests/", - "Icewind\\Streams\\": "src/" - } - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php deleted file mode 100644 index 4eef55681c7..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Wrapper that provides callbacks for write, read and close - * - * The following options should be passed in the context when opening the stream - * [ - * 'callback' => [ - * 'source' => resource - * 'read' => function($count){} (optional) - * 'write' => function($data){} (optional) - * 'close' => function(){} (optional) - * 'readdir' => function(){} (optional) - * ] - * ] - * - * All callbacks are called after the operation is executed on the source stream - */ -class CallbackWrapper extends Wrapper { - /** - * @var callable - */ - protected $readCallback; - - /** - * @var callable - */ - protected $writeCallback; - - /** - * @var callable - */ - protected $closeCallback; - - /** - * @var callable - */ - protected $readDirCallBack; - - /** - * 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 - * - * @throws \BadMethodCallException - */ - public static function wrap($source, $read = null, $write = null, $close = null, $readDir = null) { - $context = stream_context_create(array( - 'callback' => array( - 'source' => $source, - 'read' => $read, - 'write' => $write, - 'close' => $close, - 'readDir' => $readDir - ) - )); - return Wrapper::wrapSource($source, $context, 'callback', '\Icewind\Streams\CallbackWrapper'); - } - - protected function open() { - $context = $this->loadContext('callback'); - - $this->readCallback = $context['read']; - $this->writeCallback = $context['write']; - $this->closeCallback = $context['close']; - $this->readDirCallBack = $context['readDir']; - return true; - } - - public function dir_opendir($path, $options) { - return $this->open(); - } - - public function stream_open($path, $mode, $options, &$opened_path) { - return $this->open(); - } - - public function stream_read($count) { - $result = parent::stream_read($count); - if (is_callable($this->readCallback)) { - call_user_func($this->readCallback, $count); - } - return $result; - } - - public function stream_write($data) { - $result = parent::stream_write($data); - if (is_callable($this->writeCallback)) { - call_user_func($this->writeCallback, $data); - } - return $result; - } - - public function stream_close() { - $result = parent::stream_close(); - if (is_callable($this->closeCallback)) { - call_user_func($this->closeCallback); - // prevent further calls by potential PHP 7 GC ghosts - $this->closeCallback = null; - } - return $result; - } - - public function dir_readdir() { - $result = parent::dir_readdir(); - if (is_callable($this->readDirCallBack)) { - call_user_func($this->readDirCallBack); - } - return $result; - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/Directory.php b/apps/files_external/3rdparty/icewind/streams/src/Directory.php deleted file mode 100644 index c80a878386b..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/Directory.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Interface for stream wrappers that implements a directory - */ -interface Directory { - /** - * @param string $path - * @param array $options - * @return bool - */ - public function dir_opendir($path, $options); - - /** - * @return string - */ - public function dir_readdir(); - - /** - * @return bool - */ - public function dir_closedir(); - - /** - * @return bool - */ - public function dir_rewinddir(); -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php b/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php deleted file mode 100644 index 4b869699000..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Wrapper allows filtering of directories - * - * The filter callback will be called for each entry in the folder - * when the callback return false the entry will be filtered out - */ -class DirectoryFilter extends DirectoryWrapper { - /** - * @var callable - */ - private $filter; - - /** - * @param string $path - * @param array $options - * @return bool - */ - public function dir_opendir($path, $options) { - $context = $this->loadContext('filter'); - $this->filter = $context['filter']; - return true; - } - - /** - * @return string - */ - 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 - while ($file !== false && $filter($file) === false) { - $file = readdir($this->source); - } - return $file; - } - - /** - * @param resource $source - * @param callable $filter - * @return resource - */ - public static function wrap($source, callable $filter) { - $options = array( - 'filter' => array( - 'source' => $source, - 'filter' => $filter - ) - ); - return self::wrapWithOptions($options, '\Icewind\Streams\DirectoryFilter'); - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php deleted file mode 100644 index 63e4805a807..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -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; - } - - /** - * @param string $path - * @param array $options - * @return bool - */ - public function dir_opendir($path, $options) { - $this->loadContext('dir'); - return true; - } - - /** - * @return string - */ - public function dir_readdir() { - return readdir($this->source); - } - - /** - * @return bool - */ - public function dir_closedir() { - closedir($this->source); - return true; - } - - /** - * @return bool - */ - 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/File.php b/apps/files_external/3rdparty/icewind/streams/src/File.php deleted file mode 100644 index 252b7b8971f..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/File.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Interface for stream wrappers that implements a file - */ -interface File { - /** - * @param string $path - * @param string $mode - * @param int $options - * @param string &$opened_path - * @return bool - */ - public function stream_open($path, $mode, $options, &$opened_path); - - /** - * @param int $offset - * @param int $whence - * @return bool - */ - public function stream_seek($offset, $whence = SEEK_SET); - - /** - * @return int - */ - public function stream_tell(); - - /** - * @param int $count - * @return string - */ - public function stream_read($count); - - /** - * @param string $data - * @return int - */ - public function stream_write($data); - - /** - * @param int $option - * @param int $arg1 - * @param int $arg2 - * @return bool - */ - public function stream_set_option($option, $arg1, $arg2); - - /** - * @param int $size - * @return bool - */ - public function stream_truncate($size); - - /** - * @return array - */ - public function stream_stat(); - - /** - * @param int $operation - * @return bool - */ - public function stream_lock($operation); - - /** - * @return bool - */ - public function stream_flush(); - - /** - * @return bool - */ - public function stream_eof(); - - /** - * @return bool - */ - public function stream_close(); -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php b/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php deleted file mode 100644 index 6dfa42a8b68..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Create a directory handle from an iterator or array - * - * The following options should be passed in the context when opening the stream - * [ - * 'dir' => [ - * 'array' => string[] - * 'iterator' => \Iterator - * ] - * ] - * - * Either 'array' or 'iterator' need to be set, if both are set, 'iterator' takes preference - */ -class IteratorDirectory implements Directory { - /** - * @var resource - */ - public $context; - - /** - * @var \Iterator - */ - protected $iterator; - - /** - * 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['iterator'])) { - $this->iterator = $context['iterator']; - } else if (isset($context['array'])) { - $this->iterator = new \ArrayIterator($context['array']); - } else { - throw new \BadMethodCallException('Invalid context, iterator or array not set'); - } - return $context; - } - - /** - * @param string $path - * @param array $options - * @return bool - */ - public function dir_opendir($path, $options) { - $this->loadContext('dir'); - return true; - } - - /** - * @return string - */ - public function dir_readdir() { - if ($this->iterator->valid()) { - $result = $this->iterator->current(); - $this->iterator->next(); - return $result; - } else { - return false; - } - } - - /** - * @return bool - */ - public function dir_closedir() { - return true; - } - - /** - * @return bool - */ - public function dir_rewinddir() { - $this->iterator->rewind(); - return true; - } - - /** - * Creates a directory handle from the provided array or iterator - * - * @param \Iterator | array $source - * @return resource - * - * @throws \BadMethodCallException - */ - public static function wrap($source) { - if ($source instanceof \Iterator) { - $context = stream_context_create(array( - 'dir' => array( - 'iterator' => $source) - )); - } else if (is_array($source)) { - $context = stream_context_create(array( - 'dir' => array( - '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; - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/NullWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/NullWrapper.php deleted file mode 100644 index b6c71d98fc4..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/NullWrapper.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * 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'); - } - - public function stream_open($path, $mode, $options, &$opened_path) { - $this->loadContext('null'); - return true; - } - - public function dir_opendir($path, $options) { - $this->loadContext('null'); - return true; - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/Path.php b/apps/files_external/3rdparty/icewind/streams/src/Path.php deleted file mode 100644 index bef9fd5f616..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/Path.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * A string-like object that automatically registers a stream wrapper when used and removes the stream wrapper when no longer used - * - * Can optionally pass context options to the stream wrapper - */ -class Path { - - /** - * @var bool - */ - protected $registered = false; - - /** - * @var string - */ - protected $protocol; - - /** - * @var string - */ - protected $class; - - /** - * @var array - */ - protected $contextOptions; - - /** - * @param string $class - * @param array $contextOptions - */ - public function __construct($class, $contextOptions = array()) { - $this->class = $class; - $this->contextOptions = $contextOptions; - } - - public function getProtocol() { - if (!$this->protocol) { - $this->protocol = 'auto' . uniqid(); - } - return $this->protocol; - } - - public function wrapPath($path) { - return $this->getProtocol() . '://' . $path; - } - - protected function register() { - if (!$this->registered) { - $this->appendDefaultContent($this->contextOptions); - stream_wrapper_register($this->getProtocol(), $this->class); - $this->registered = true; - } - } - - protected function unregister() { - stream_wrapper_unregister($this->getProtocol()); - $this->unsetDefaultContent($this->getProtocol()); - $this->registered = false; - } - - /** - * Add values to the default stream context - * - * @param array $values - */ - protected function appendDefaultContent($values) { - if (!is_array(current($values))) { - $values = array($this->getProtocol() => $values); - } - $context = stream_context_get_default(); - $defaults = stream_context_get_options($context); - foreach ($values as $key => $value) { - $defaults[$key] = $value; - } - stream_context_set_default($defaults); - } - - /** - * Remove values from the default stream context - * - * @param string $key - */ - protected function unsetDefaultContent($key) { - $context = stream_context_get_default(); - $defaults = stream_context_get_options($context); - unset($defaults[$key]); - stream_context_set_default($defaults); - } - - public function __toString() { - $this->register(); - return $this->protocol . '://'; - } - - public function __destruct() { - $this->unregister(); - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php deleted file mode 100644 index 88af7e17b33..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * Copyright (c) 2016 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * A string-like object that maps to an existing stream when opened - */ -class PathWrapper extends NullWrapper { - /** - * @param resource $source - * @return Path|string - */ - public static function getPath($source) { - return new Path(__CLASS__, [ - 'null' => [ - 'source' => $source - ] - ]); - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php deleted file mode 100644 index 8238f19f7c9..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Copyright (c) 2016 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * 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; - } - - public function dir_opendir($path, $options) { - return false; - } - - public function stream_open($path, $mode, $options, &$opened_path) { - return $this->open(); - } - - public function stream_read($count) { - $result = parent::stream_read($count); - - $bytesReceived = strlen($result); - while (strlen($result) > 0 && $bytesReceived < $count && !$this->stream_eof()) { - $result .= parent::stream_read($count - $bytesReceived); - $bytesReceived = strlen($result); - } - - return $result; - } - - public function stream_write($data) { - $bytesToSend = strlen($data); - $bytesWritten = parent::stream_write($data); - $result = $bytesWritten; - - while ($bytesWritten > 0 && $result < $bytesToSend && !$this->stream_eof()) { - $dataLeft = substr($data, $result); - $bytesWritten = parent::stream_write($dataLeft); - $result += $bytesWritten; - } - - return $result; - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php deleted file mode 100644 index d41fd73ec9c..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Wrapper that provides callbacks for write, read and close - * - * The following options should be passed in the context when opening the stream - * [ - * 'callback' => [ - * 'source' => resource - * ] - * ] - * - * All callbacks are called after the operation is executed on the source stream - */ -class SeekableWrapper extends Wrapper { - /** - * @var resource - */ - 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'); - } - - public function dir_opendir($path, $options) { - return false; - } - - public function stream_open($path, $mode, $options, &$opened_path) { - $this->loadContext('callback'); - $this->cache = fopen('php://temp', 'w+'); - return true; - } - - protected function readTill($position) { - $current = ftell($this->source); - if ($position > $current) { - $data = parent::stream_read($position - $current); - $cachePosition = ftell($this->cache); - fseek($this->cache, $current); - fwrite($this->cache, $data); - fseek($this->cache, $cachePosition); - } - } - - public function stream_read($count) { - $current = ftell($this->cache); - $this->readTill($current + $count); - return fread($this->cache, $count); - } - - public function stream_seek($offset, $whence = SEEK_SET) { - if ($whence === SEEK_SET) { - $target = $offset; - } else if ($whence === SEEK_CUR) { - $current = ftell($this->cache); - $target = $current + $offset; - } else { - return false; - } - $this->readTill($target); - return fseek($this->cache, $target) === 0; - } - - public function stream_tell() { - return ftell($this->cache); - } - - public function stream_eof() { - return parent::stream_eof() and (ftell($this->source) === ftell($this->cache)); - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/Url.php b/apps/files_external/3rdparty/icewind/streams/src/Url.php deleted file mode 100644 index d6822608a33..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/Url.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Interface for stream wrappers that implement url functions such as unlink, stat - */ -interface Url { - /** - * @param string $path - * @param array $options - * @return bool - */ - public function dir_opendir($path, $options); - - /** - * @param string $path - * @param string $mode - * @param int $options - * @param string &$opened_path - * @return bool - */ - public function stream_open($path, $mode, $options, &$opened_path); - - /** - * @param string $path - * @param int $mode - * @param int $options - * @return bool - */ - public function mkdir($path, $mode, $options); - - /** - * @param string $source - * @param string $target - * @return bool - */ - public function rename($source, $target); - - /** - * @param string $path - * @param int $options - * @return bool - */ - public function rmdir($path, $options); - - /** - * @param string - * @return bool - */ - public function unlink($path); - - /** - * @param string $path - * @param int $flags - * @return array - */ - public function url_stat($path, $flags); -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/UrlCallBack.php b/apps/files_external/3rdparty/icewind/streams/src/UrlCallBack.php deleted file mode 100644 index 580bfc6ba22..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/UrlCallBack.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Wrapper that provides callbacks for url actions such as fopen, unlink, rename - * - * Usage: - * - * $path = UrlCallBack('/path/so/source', function(){ - * echo 'fopen'; - * }, function(){ - * echo 'opendir'; - * }, function(){ - * echo 'mkdir'; - * }, function(){ - * echo 'rename'; - * }, function(){ - * echo 'rmdir'; - * }, function(){ - * echo 'unlink'; - * }, function(){ - * echo 'stat'; - * }); - * - * mkdir($path); - * ... - * - * All callbacks are called after the operation is executed on the source stream - */ -class UrlCallback extends Wrapper implements Url { - - /** - * @param string $source - * @param callable $fopen - * @param callable $opendir - * @param callable $mkdir - * @param callable $rename - * @param callable $rmdir - * @param callable $unlink - * @param callable $stat - * @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( - 'source' => $source, - 'fopen' => $fopen, - 'opendir' => $opendir, - 'mkdir' => $mkdir, - 'rename' => $rename, - 'rmdir' => $rmdir, - 'unlink' => $unlink, - 'stat' => $stat - ); - return new Path('\Icewind\Streams\UrlCallBack', $options); - } - - protected function loadContext($url) { - list($protocol) = explode('://', $url); - $options = stream_context_get_options($this->context); - return $options[$protocol]; - } - - protected function callCallBack($context, $callback) { - if (is_callable($context[$callback])) { - call_user_func($context[$callback]); - } - } - - public function stream_open($path, $mode, $options, &$opened_path) { - $context = $this->loadContext($path); - $this->callCallBack($context, 'fopen'); - $this->setSourceStream(fopen($context['source'], $mode)); - return true; - } - - public function dir_opendir($path, $options) { - $context = $this->loadContext($path); - $this->callCallBack($context, 'opendir'); - $this->setSourceStream(opendir($context['source'])); - return true; - } - - public function mkdir($path, $mode, $options) { - $context = $this->loadContext($path); - $this->callCallBack($context, 'mkdir'); - return mkdir($context['source'], $mode, $options & STREAM_MKDIR_RECURSIVE); - } - - public function rmdir($path, $options) { - $context = $this->loadContext($path); - $this->callCallBack($context, 'rmdir'); - return rmdir($context['source']); - } - - public function rename($source, $target) { - $context = $this->loadContext($source); - $this->callCallBack($context, 'rename'); - list(, $target) = explode('://', $target); - return rename($context['source'], $target); - } - - public function unlink($path) { - $context = $this->loadContext($path); - $this->callCallBack($context, 'unlink'); - return unlink($context['source']); - } - - public function url_stat($path, $flags) { - throw new \Exception('stat is not supported due to php bug 50526'); - } -} diff --git a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php deleted file mode 100644 index 8e52eff9a08..00000000000 --- a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Licensed under the MIT license: - * http://opensource.org/licenses/MIT - */ - -namespace Icewind\Streams; - -/** - * Base class for stream wrappers, wraps an existing stream - * - * 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 { - /** - * @var resource - */ - public $context; - - /** - * The wrapped stream - * - * @var resource - */ - 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 - * - * @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->setSourceStream($context['source']); - } else { - throw new \BadMethodCallException('Invalid context, source not set'); - } - 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; - } - - public function stream_tell() { - return ftell($this->source); - } - - public function stream_read($count) { - return fread($this->source, $count); - } - - public function stream_write($data) { - return fwrite($this->source, $data); - } - - public function stream_set_option($option, $arg1, $arg2) { - switch ($option) { - case STREAM_OPTION_BLOCKING: - stream_set_blocking($this->source, $arg1); - break; - case STREAM_OPTION_READ_TIMEOUT: - stream_set_timeout($this->source, $arg1, $arg2); - break; - case STREAM_OPTION_WRITE_BUFFER: - stream_set_write_buffer($this->source, $arg1); - } - } - - public function stream_truncate($size) { - return ftruncate($this->source, $size); - } - - public function stream_stat() { - return fstat($this->source); - } - - public function stream_lock($mode) { - return flock($this->source, $mode); - } - - public function stream_flush() { - return fflush($this->source); - } - - public function stream_eof() { - return feof($this->source); - } - - 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); - } -} |