Skip to content

Commit

Permalink
Merge pull request #23351 from owncloud/streams-0.4
Browse files Browse the repository at this point in the history
Update icewind/streams and icewind/smb
  • Loading branch information
Vincent Petry committed Mar 21, 2016
2 parents 86581f6 + 7927527 commit 2309ef9
Show file tree
Hide file tree
Showing 35 changed files with 785 additions and 489 deletions.
2 changes: 1 addition & 1 deletion 3rdparty
1 change: 1 addition & 0 deletions apps/files_external/3rdparty/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ example.php
icewind/smb/tests
icewind/smb/install_libsmbclient.sh
icewind/smb/.travis.yml
icewind/streams/tests
4 changes: 2 additions & 2 deletions apps/files_external/3rdparty/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"classmap-authoritative": true
},
"require": {
"icewind/smb": "1.0.5",
"icewind/streams": "0.2"
"icewind/smb": "1.0.8",
"icewind/streams": "0.4"
}
}

29 changes: 15 additions & 14 deletions apps/files_external/3rdparty/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions apps/files_external/3rdparty/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
namespace Composer\Autoload;

/**
* ClassLoader implements a PSR-0 class loader
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
Expand All @@ -39,6 +37,8 @@
*
* @author Fabien Potencier <[email protected]>
* @author Jordi Boggiano <[email protected]>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
Expand Down Expand Up @@ -147,7 +147,7 @@ public function add($prefix, $paths, $prepend = false)
* 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-0 base directories
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
Expand Down
19 changes: 15 additions & 4 deletions apps/files_external/3rdparty/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,23 @@
'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\\Tests\\CallbackWrapper' => $vendorDir . '/icewind/streams/tests/CallbackWrapper.php',
'Icewind\\Streams\\Tests\\IteratorDirectory' => $vendorDir . '/icewind/streams/tests/IteratorDirectory.php',
'Icewind\\Streams\\Tests\\NullWrapper' => $vendorDir . '/icewind/streams/tests/NullWrapper.php',
'Icewind\\Streams\\Tests\\Wrapper' => $vendorDir . '/icewind/streams/tests/Wrapper.php',
'Icewind\\Streams\\Path' => $vendorDir . '/icewind/streams/src/Path.php',
'Icewind\\Streams\\RetryWrapper' => $vendorDir . '/icewind/streams/src/RetryWrapper.php',
'Icewind\\Streams\\SeekableWrapper' => $vendorDir . '/icewind/streams/src/SeekableWrapper.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\\PartialWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.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\\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',
);
15 changes: 0 additions & 15 deletions apps/files_external/3rdparty/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ public static function getLoader()
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3', 'loadClassLoader'));

$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}

$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}

$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
Expand All @@ -44,8 +34,3 @@ public static function getLoader()
return $loader;
}
}

function composerRequire98fe9b281934250b3a93f69a5ce843b3($file)
{
require $file;
}
29 changes: 15 additions & 14 deletions apps/files_external/3rdparty/composer/installed.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
[
{
"name": "icewind/streams",
"version": "0.2",
"version_normalized": "0.2.0.0",
"version": "0.4.0",
"version_normalized": "0.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/Streams.git",
"reference": "5aae45f2ddd3d1a6e2a496dd5d1e7857bfeb605a"
"reference": "9ca40274645a967ecc3408b0ca2e6255ead1d1d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/5aae45f2ddd3d1a6e2a496dd5d1e7857bfeb605a",
"reference": "5aae45f2ddd3d1a6e2a496dd5d1e7857bfeb605a",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/9ca40274645a967ecc3408b0ca2e6255ead1d1d3",
"reference": "9ca40274645a967ecc3408b0ca2e6255ead1d1d3",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"satooshi/php-coveralls": "dev-master"
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
},
"time": "2014-07-30 23:46:15",
"time": "2016-03-17 12:32:25",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -43,28 +44,28 @@
},
{
"name": "icewind/smb",
"version": "v1.0.5",
"version_normalized": "1.0.5.0",
"version": "v1.0.8",
"version_normalized": "1.0.8.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
"reference": "acb94a0a85290d653cd64c883175b855ada5022f"
"reference": "764f3fc793a904eb937d619ad097fb076ff199cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/acb94a0a85290d653cd64c883175b855ada5022f",
"reference": "acb94a0a85290d653cd64c883175b855ada5022f",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/764f3fc793a904eb937d619ad097fb076ff199cd",
"reference": "764f3fc793a904eb937d619ad097fb076ff199cd",
"shasum": ""
},
"require": {
"icewind/streams": "0.2.*",
"icewind/streams": ">=0.2.0",
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
},
"time": "2016-01-20 13:12:36",
"time": "2016-03-17 13:29:58",
"type": "library",
"installation-source": "source",
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/3rdparty/icewind/smb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ $share = $server->getShare('test');
$content = $share->dir('test');

foreach ($content as $info) {
echo $name->getName() . "\n";
echo $info->getName() . "\n";
echo "\tsize :" . $info->getSize() . "\n";
}
```
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/3rdparty/icewind/smb/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"require" : {
"php": ">=5.3",
"icewind/streams": "0.2.*"
"icewind/streams": ">=0.2.0"
},
"require-dev": {
"satooshi/php-coveralls" : "v1.0.0",
Expand Down
10 changes: 6 additions & 4 deletions apps/files_external/3rdparty/icewind/smb/src/NativeShare.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ public function get($source, $target) {
*/
public function read($source) {
$this->connect();
$handle = $this->state->open($this->buildUrl($source), 'r');
return NativeStream::wrap($this->state, $handle, 'r');
$url = $this->buildUrl($source);
$handle = $this->state->open($url, 'r');
return NativeStream::wrap($this->state, $handle, 'r', $url);
}

/**
Expand All @@ -254,8 +255,9 @@ public function read($source) {
*/
public function write($source) {
$this->connect();
$handle = $this->state->create($this->buildUrl($source));
return NativeStream::wrap($this->state, $handle, 'w');
$url = $this->buildUrl($source);
$handle = $this->state->create($url);
return NativeStream::wrap($this->state, $handle, 'w', $url);
}

/**
Expand Down
19 changes: 16 additions & 3 deletions apps/files_external/3rdparty/icewind/smb/src/NativeStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Icewind\SMB;

use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\InvalidRequestException;
use Icewind\Streams\File;

Expand All @@ -31,20 +32,27 @@ class NativeStream implements File {
*/
private $eof = false;

/**
* @var string
*/
private $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) {
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
'handle' => $smbStream,
'url' => $url
)
));
$fh = fopen('nativesmb://', $mode, false, $context);
Expand All @@ -68,6 +76,7 @@ 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;
}

Expand All @@ -89,7 +98,11 @@ public function stream_seek($offset, $whence = SEEK_SET) {
}

public function stream_stat() {
return $this->state->fstat($this->handle);
try {
return $this->state->stat($this->url);
} catch (Exception $e) {
return false;
}
}

public function stream_tell() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "icewind/streams-dummy",
"provide": {
"icewind/streams": "0.2"
}
}

7 changes: 4 additions & 3 deletions apps/files_external/3rdparty/icewind/streams/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm

matrix:
allow_failures:
- php: hhvm # due to facebook/hhvm#3321
allow_failures:
- php: hhvm # due to facebook/hhvm#3321

env:
global:
Expand Down
21 changes: 21 additions & 0 deletions apps/files_external/3rdparty/icewind/streams/LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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.
Loading

0 comments on commit 2309ef9

Please sign in to comment.