diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2016-08-23 13:19:30 +0300 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2016-08-26 10:38:01 +0300 |
commit | 1ac6f4f811a769b38b9a0c94c7c109e39429148a (patch) | |
tree | 01565bc2fb544c7fdb7f2f0954fe64b4bff4a870 /apps | |
parent | d253b6dfab3d7699ce425efe7c12417eb02493b0 (diff) |
fix test execution due to connection limit
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/lib/smb.php | 15 | ||||
-rw-r--r-- | apps/files_external/tests/backends/smb.php | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index 86ea6593ff3..4b6a7f4b04b 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -129,10 +129,10 @@ class SMB extends Common { $path = $this->buildPath($path); if (!isset($this->statCache[$path])) { try { - $this->log("stat fetching '{$this->root}|$path'"); + $this->log("stat fetching '$path'"); $this->statCache[$path] = $this->share->stat($path); if ($this->remoteIsShare() && $this->isRootDir($path) && $this->statCache[$path]->isHidden()) { - $this->log(" stat for '{$this->root}|$path'"); + $this->log(" stat for '$path'"); // make root never hidden, may happen when accessing a shared drive (mode is 22, archived and readonly - neither is true ... whatever) if ($this->statCache[$path]->isReadOnly()) { $mode = FileInfo::MODE_DIRECTORY & FileInfo::MODE_READONLY; @@ -492,8 +492,7 @@ class SMB extends Common { $result = false; $path = $this->buildPath($path); try { - $this->share->mkdir($path); - $result = true; + $result = $this->share->mkdir($path); } catch (ConnectException $e) { $ex = new StorageNotAvailableException( $e->getMessage(), $e->getCode(), $e); @@ -594,7 +593,6 @@ class SMB extends Common { return $this->leave(__FUNCTION__, $result); } - /** * @param string $message * @param int $level @@ -645,4 +643,11 @@ class SMB extends Common { .' trace: '.$exception->getTraceAsString(), Util::DEBUG); } } + + /** + * immediately close / free connection + */ + public function __destruct() { + unset($this->share); + } } diff --git a/apps/files_external/tests/backends/smb.php b/apps/files_external/tests/backends/smb.php index f9a377c271b..bbe218979b4 100644 --- a/apps/files_external/tests/backends/smb.php +++ b/apps/files_external/tests/backends/smb.php @@ -47,12 +47,14 @@ class SMB extends Storage { } $config['root'] .= $id; //make sure we have an new empty folder to work in $this->instance = new \OC\Files\Storage\SMB($config); - $this->instance->mkdir('/'); + $this->assertTrue($this->instance->mkdir('/')); } protected function tearDown() { if ($this->instance) { $this->instance->rmdir(''); + // force disconnect of the client + unset($this->instance); } parent::tearDown(); |