Skip to content

Commit 96e4058

Browse files
Conflict resolve
1 parent 8a86079 commit 96e4058

2 files changed

Lines changed: 0 additions & 146 deletions

File tree

lib/private/Files/ObjectStore/S3ConnectionTrait.php

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -90,127 +90,8 @@ public function getBucket() {
9090
return $this->bucket;
9191
}
9292

93-
<<<<<<< HEAD
9493
public function getProxy() {
9594
return $this->proxy;
96-
=======
97-
/**
98-
* Add the SSE KMS parameterdepending on the
99-
* KMS encryption strategy (bucket, individual or
100-
* no encryption) for object creations.
101-
*
102-
* @return array with encryption parameters
103-
*/
104-
public function getSseKmsPutParameters(): array {
105-
if (!empty($this->sseKmsBucketKeyId)) {
106-
return [
107-
'ServerSideEncryption' => 'aws:kms',
108-
];
109-
} elseif (!empty($this->sseKmsKeyId)) {
110-
return [
111-
'ServerSideEncryption' => 'aws:kms',
112-
'SSEKMSKeyId' => $this->sseKmsKeyId,
113-
];
114-
} else {
115-
return [];
116-
}
117-
}
118-
119-
/**
120-
* Add the SSE KMS parameter depending on the
121-
* KMS encryption strategy (bucket, individual or
122-
* no encryption) for object read.
123-
*
124-
* @return array with encryption parameters
125-
*/
126-
public function getSseKmsGetParameters(): array {
127-
if (!empty($this->sseKmsBucketKeyId)) {
128-
return [
129-
'ServerSideEncryption' => 'aws:kms',
130-
'SSEKMSKeyId' => $this->sseKmsBucketKeyId,
131-
];
132-
} elseif (!empty($this->sseKmsKeyId)) {
133-
return [
134-
'ServerSideEncryption' => 'aws:kms',
135-
'SSEKMSKeyId' => $this->sseKmsKeyId,
136-
];
137-
} else {
138-
return [];
139-
}
140-
}
141-
142-
143-
/**
144-
* Create the required bucket
145-
*
146-
* @throws \Exception if bucket creation fails
147-
*/
148-
protected function createNewBucket() {
149-
$logger = \OC::$server->getLogger();
150-
try {
151-
$logger->info('Bucket "'.$this->bucket.'" does not exist - creating it.', ['app' => 'objectstore']);
152-
if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
153-
throw new \Exception('The bucket will not be created because the name is not dns compatible, please correct it: '.$this->bucket);
154-
}
155-
$this->connection->createBucket(['Bucket' => $this->bucket]);
156-
$this->testTimeout();
157-
} catch (S3Exception $e) {
158-
$logger->logException($e, [
159-
'message' => 'Invalid remote storage.',
160-
'level' => ILogger::DEBUG,
161-
'app' => 'objectstore',
162-
]);
163-
throw new \Exception('Creation of bucket "'.$this->bucket.'" failed. '.$e->getMessage());
164-
}
165-
}
166-
167-
/**
168-
* Check bucket key consistency or put bucket key if missing
169-
* This operation only works for bucket owner or with
170-
* s3:GetEncryptionConfiguration/s3:PutEncryptionConfiguration permission
171-
*
172-
* We recommend to use autocreate only on initial setup and
173-
* use an S3:user only with object operation permission and no bucket operation permissions
174-
* later with autocreate=false
175-
*
176-
* @throws \Exception if bucket key config is inconsistent or if putting the key fails
177-
*/
178-
protected function checkOrPutBucketKey() {
179-
$logger = \OC::$server->getLogger();
180-
181-
try {
182-
$encrypt_state = $this->connection->getBucketEncryption([
183-
'Bucket' => $this->bucket,
184-
]);
185-
return;
186-
} catch (S3Exception $e) {
187-
try {
188-
$logger->info('Bucket key for "'.$this->bucket.'" is not set - adding it.', ['app' => 'objectstore']);
189-
$this->connection->putBucketEncryption([
190-
'Bucket' => $this->bucket ,
191-
'ServerSideEncryptionConfiguration' => [
192-
'Rules' => [
193-
[
194-
'ApplyServerSideEncryptionByDefault' => [
195-
'KMSMasterKeyID' => $this->sseKmsBucketKeyId,
196-
'SSEAlgorithm' => 'aws:kms',
197-
],
198-
'BucketKeyEnabled' => true,
199-
],
200-
],
201-
],
202-
]);
203-
$this->testTimeout();
204-
} catch (S3Exception $e) {
205-
$logger->logException($e, [
206-
'message' => 'Bucket key problem.',
207-
'level' => ILogger::DEBUG,
208-
'app' => 'objectstore',
209-
]);
210-
throw new \Exception('Putting configured bucket key to "'.$this->bucket.'" failed. '.$e->getMessage());
211-
}
212-
}
213-
>>>>>>> Fix small syntax problem
21495
}
21596

21697
/**

lib/private/Files/ObjectStore/S3ObjectTrait.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public function readObject($urn) {
8181
}
8282

8383
/**
84-
<<<<<<< HEAD
8584
* Single object put helper
8685
*
8786
* @param string $urn the unified resource name used to identify the object
@@ -99,19 +98,6 @@ protected function writeSingle(string $urn, StreamInterface $stream, string $mim
9998
]);
10099
}
101100

102-
=======
103-
* @param string $urn the unified resource name used to identify the object
104-
* @param resource $stream stream with the data to write
105-
* @param string|null $mimetype the mimetype to set for the remove object @since 22.0.0
106-
* @throws \Exception when something goes wrong, message will be logged
107-
* @since 7.0.0
108-
*/
109-
public function writeObject($urn, $stream, string $mimetype = null) {
110-
$count = 0;
111-
$countStream = CallbackWrapper::wrap($stream, function ($read) use (&$count) {
112-
$count += $read;
113-
});
114-
>>>>>>> Keep miemtype handling for writeObject
115101

116102
/**
117103
* Multipart upload helper that tries to avoid orphaned fragments in S3
@@ -128,14 +114,8 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, string $
128114
'part_size' => $this->uploadPartSize,
129115
'params' => [
130116
'ContentType' => $mimetype
131-
<<<<<<< HEAD
132117
],
133118
]);
134-
=======
135-
] + $this->getSseKmsPutParameters(),
136-
];
137-
$uploader = new MultipartUploader($this->getConnection(), $countStream, $s3params);
138-
>>>>>>> Keep miemtype handling for writeObject
139119

140120
try {
141121
$uploader->upload();
@@ -191,14 +171,7 @@ public function deleteObject($urn) {
191171
public function objectExists($urn) {
192172
return $this->getConnection()->doesObjectExist($this->bucket, $urn);
193173
}
194-
<<<<<<< HEAD
195174

196-
=======
197-
198-
/**
199-
* S3 copy command with SSE KMS key handling.
200-
*/
201-
>>>>>>> Keep miemtype handling for writeObject
202175
public function copyObject($from, $to) {
203176
$this->getConnection()->copy($this->getBucket(), $from, $this->getBucket(), $to);
204177
}

0 commit comments

Comments
 (0)