summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/amazons3.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/amazons3.php')
-rw-r--r--apps/files_external/lib/amazons3.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index 37e53a3a670..7bcefd4176c 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -33,12 +33,16 @@ class AmazonS3 extends \OC\Files\Storage\Common {
private static $tempFiles = array();
- // TODO options: storage class, encryption server side, encrypt before upload?
+ // TODO Update to new AWS SDK
public function __construct($params) {
- $this->id = 'amazon::' . $params['key'] . md5($params['secret']);
- $this->s3 = new \AmazonS3(array('key' => $params['key'], 'secret' => $params['secret']));
- $this->bucket = $params['bucket'];
+ if (isset($params['key']) && isset($params['secret']) && isset($params['bucket'])) {
+ $this->id = 'amazon::' . $params['key'] . md5($params['secret']);
+ $this->s3 = new \AmazonS3(array('key' => $params['key'], 'secret' => $params['secret']));
+ $this->bucket = $params['bucket'];
+ } else {
+ throw new \Exception();
+ }
}
private function getObject($path) {
@@ -240,4 +244,12 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return $response->isOK();
}
+ public function test() {
+ $test = $this->s3->get_canonical_user_id();
+ if (isset($test['id']) && $test['id'] != '') {
+ return true;
+ }
+ return false;
+ }
+
}