diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-12-24 13:45:52 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-12-24 13:45:52 -0500 |
commit | 0dbf1d02600ef4075ceffe9c62c1ed32cc24592f (patch) | |
tree | 2db27ca226035add120fec8f2ca529c84001d0f6 /apps/files_external/lib/smb.php | |
parent | 5fb4ed2d92b28bfcd0647233421a3614b00e6d4c (diff) | |
download | nextcloud-server-0dbf1d02600ef4075ceffe9c62c1ed32cc24592f.tar.gz nextcloud-server-0dbf1d02600ef4075ceffe9c62c1ed32cc24592f.zip |
Show status icons for mount points in external storage UI
Diffstat (limited to 'apps/files_external/lib/smb.php')
-rw-r--r-- | apps/files_external/lib/smb.php | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index 071a9cd5f95..97454b46015 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -16,28 +16,36 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ private $share; public function __construct($params) { - $this->host=$params['host']; - $this->user=$params['user']; - $this->password=$params['password']; - $this->share=$params['share']; - $this->root=isset($params['root'])?$params['root']:'/'; - if ( ! $this->root || $this->root[0]!='/') { - $this->root='/'.$this->root; - } - if (substr($this->root, -1, 1)!='/') { - $this->root.='/'; - } - if ( ! $this->share || $this->share[0]!='/') { - $this->share='/'.$this->share; - } - if (substr($this->share, -1, 1)=='/') { - $this->share=substr($this->share, 0, -1); - } - - //create the root folder if necesary - if ( ! $this->is_dir('')) { - $this->mkdir(''); + if (isset($params['host']) && isset($params['user']) && isset($params['password']) && isset($params['share'])) { + $this->host=$params['host']; + $this->user=$params['user']; + $this->password=$params['password']; + $this->share=$params['share']; + $this->root=isset($params['root'])?$params['root']:'/'; + if ( ! $this->root || $this->root[0]!='/') { + $this->root='/'.$this->root; + } + if (substr($this->root, -1, 1)!='/') { + $this->root.='/'; + } + if ( ! $this->share || $this->share[0]!='/') { + $this->share='/'.$this->share; + } + if (substr($this->share, -1, 1)=='/') { + $this->share=substr($this->share, 0, -1); + } + $test = $this->stat(''); + if (!$test) { + throw new Exception(); + } + //create the root folder if necesary + if ( ! $this->is_dir('')) { + $this->mkdir(''); + } + } else { + throw new Exception(); } + } public function constructUrl($path) { |