Merge pull request #17299 from nextcloud/backport/17258/stable16
[stable16] add (hidden) option to configure smb timeout
This commit is contained in:
commit
8918b0174f
2 changed files with 11 additions and 1 deletions
|
@ -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')))
|
||||
->setType(DefinitionParameter::VALUE_HIDDEN)
|
||||
])
|
||||
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
|
||||
->addAuthScheme(AuthMechanism::SCHEME_SMB)
|
||||
|
|
|
@ -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;
|
||||
|
@ -106,7 +107,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'], '/'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue