diff options
author | Robin Appelman <robin@icewind.nl> | 2019-09-25 13:30:40 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2019-09-25 13:30:40 +0200 |
commit | 194edfc64e6450cec697548cc058b47ffb0d2804 (patch) | |
tree | e9c0a47092819337b29e7c509afe62a0d229ad4f /apps/files_external | |
parent | 507eb30e1d7ab2ea31934796621cd6614c2af750 (diff) | |
download | nextcloud-server-194edfc64e6450cec697548cc058b47ffb0d2804.tar.gz nextcloud-server-194edfc64e6450cec697548cc058b47ffb0d2804.zip |
add (hidden) option to configure smb timeout
hidden from ui to prevent clutter
```occ files_external:config <mount> timeout 30```
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/Lib/Backend/SMB.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php index 0543247051f..40888d86d27 100644 --- a/apps/files_external/lib/Lib/Backend/SMB.php +++ b/apps/files_external/lib/Lib/Backend/SMB.php @@ -53,6 +53,8 @@ class SMB extends Backend { (new DefinitionParameter('show_hidden', $l->t('Show hidden files'))) ->setType(DefinitionParameter::VALUE_BOOLEAN) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), + (new DefinitionParameter('timeout', $l->t('Timeout'))) + ->setFlag(DefinitionParameter::VALUE_HIDDEN) ]) ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) ->addAuthScheme(AuthMechanism::SCHEME_SMB) diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index bff23160944..e0966aa4072 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -44,6 +44,7 @@ use Icewind\SMB\Exception\NotFoundException; use Icewind\SMB\Exception\TimedOutException; use Icewind\SMB\IFileInfo; use Icewind\SMB\Native\NativeServer; +use Icewind\SMB\Options; use Icewind\SMB\ServerFactory; use Icewind\SMB\System; use Icewind\Streams\CallbackWrapper; @@ -105,7 +106,14 @@ class SMB extends Common implements INotifyStorage { $this->logger = \OC::$server->getLogger(); } - $serverFactory = new ServerFactory(); + $options = new Options(); + if (isset($params['timeout'])) { + $timeout = (int)$params['timeout']; + if ($timeout > 0) { + $options->setTimeout($timeout); + } + } + $serverFactory = new ServerFactory($options); $this->server = $serverFactory->createServer($params['host'], $auth); $this->share = $this->server->getShare(trim($params['share'], '/')); |