From 0dbf1d02600ef4075ceffe9c62c1ed32cc24592f Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 24 Dec 2012 13:45:52 -0500 Subject: Show status icons for mount points in external storage UI --- apps/files_external/lib/swift.php | 45 ++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'apps/files_external/lib/swift.php') diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php index a071dfdbb03..e2add2c9873 100644 --- a/apps/files_external/lib/swift.php +++ b/apps/files_external/lib/swift.php @@ -267,32 +267,37 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } public function __construct($params) { - $this->token=$params['token']; - $this->host=$params['host']; - $this->user=$params['user']; - $this->root=isset($params['root'])?$params['root']:'/'; - if (isset($params['secure'])) { - if (is_string($params['secure'])) { - $this->secure = ($params['secure'] === 'true'); + if (isset($params['token']) && isset($params['host']) && isset($params['user'])) { + $this->token=$params['token']; + $this->host=$params['host']; + $this->user=$params['user']; + $this->root=isset($params['root'])?$params['root']:'/'; + if (isset($params['secure'])) { + if (is_string($params['secure'])) { + $this->secure = ($params['secure'] === 'true'); + } else { + $this->secure = (bool)$params['secure']; + } } else { - $this->secure = (bool)$params['secure']; + $this->secure = false; } - } else { - $this->secure = false; - } - if ( ! $this->root || $this->root[0]!='/') { - $this->root='/'.$this->root; - } - $this->auth = new CF_Authentication($this->user, $this->token, null, $this->host); - $this->auth->authenticate(); + if ( ! $this->root || $this->root[0]!='/') { + $this->root='/'.$this->root; + } + $this->auth = new CF_Authentication($this->user, $this->token, null, $this->host); + $this->auth->authenticate(); - $this->conn = new CF_Connection($this->auth); + $this->conn = new CF_Connection($this->auth); - if ( ! $this->containerExists('/')) { - $this->rootContainer=$this->createContainer('/'); + if ( ! $this->containerExists('/')) { + $this->rootContainer=$this->createContainer('/'); + } else { + $this->rootContainer=$this->getContainer('/'); + } } else { - $this->rootContainer=$this->getContainer('/'); + throw new Exception(); } + } -- cgit v1.2.3