Merge pull request #11721 from owncloud/fix-s3-regression

[master] Fix S3 connection regression
This commit is contained in:
Morris Jobke 2014-10-23 12:42:42 +02:00
commit 7c14a17361
1 changed files with 11 additions and 5 deletions

View File

@ -45,6 +45,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
* @var array * @var array
*/ */
private static $tmpFiles = array(); private static $tmpFiles = array();
/**
* @var array
*/
private $params;
/** /**
* @var bool * @var bool
*/ */
@ -101,7 +105,6 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$this->updateLegacyId($params); $this->updateLegacyId($params);
$this->bucket = $params['bucket']; $this->bucket = $params['bucket'];
$scheme = ($params['use_ssl'] === 'false') ? 'http' : 'https';
$this->test = isset($params['test']); $this->test = isset($params['test']);
$this->timeout = (!isset($params['timeout'])) ? 15 : $params['timeout']; $this->timeout = (!isset($params['timeout'])) ? 15 : $params['timeout'];
$this->rescanDelay = (!isset($params['rescanDelay'])) ? 10 : $params['rescanDelay']; $this->rescanDelay = (!isset($params['rescanDelay'])) ? 10 : $params['rescanDelay'];
@ -110,7 +113,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
if (!isset($params['port']) || $params['port'] === '') { if (!isset($params['port']) || $params['port'] === '') {
$params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443; $params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443;
} }
$base_url = $scheme . '://' . $params['hostname'] . ':' . $params['port'] . '/'; $this->params = $params;
} }
/** /**
@ -550,11 +553,14 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return $this->connection; return $this->connection;
} }
$scheme = ($this->params['use_ssl'] === 'false') ? 'http' : 'https';
$base_url = $scheme . '://' . $this->params['hostname'] . ':' . $this->params['port'] . '/';
$this->connection = S3Client::factory(array( $this->connection = S3Client::factory(array(
'key' => $params['key'], 'key' => $this->params['key'],
'secret' => $params['secret'], 'secret' => $this->params['secret'],
'base_url' => $base_url, 'base_url' => $base_url,
'region' => $params['region'] 'region' => $this->params['region']
)); ));
if (!$this->connection->isValidBucketName($this->bucket)) { if (!$this->connection->isValidBucketName($this->bucket)) {