diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-16 21:14:16 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-21 16:25:42 +0100 |
commit | 69c5e8ebde761806883441daa693a491664eabc8 (patch) | |
tree | 8efd1897f0a74c5459623908543c34e9fe9d3d8f /lib/private | |
parent | a7dfec070a1dda79ade7cfea91b3dc7e74d184a6 (diff) | |
download | nextcloud-server-69c5e8ebde761806883441daa693a491664eabc8.tar.gz nextcloud-server-69c5e8ebde761806883441daa693a491664eabc8.zip |
fix(ObjectStore): Use common S3 trait so config and connection trait members are in sync
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConfigTrait.php | 50 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 34 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3ObjectTrait.php | 2 |
3 files changed, 56 insertions, 30 deletions
diff --git a/lib/private/Files/ObjectStore/S3ConfigTrait.php b/lib/private/Files/ObjectStore/S3ConfigTrait.php new file mode 100644 index 00000000000..b73cb7e484d --- /dev/null +++ b/lib/private/Files/ObjectStore/S3ConfigTrait.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2024 Ferdinand Thiessen <opensource@fthiessen.de> + * + * @author Ferdinand Thiessen <opensource@fthiessen.de> + * + * @license GNU AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Files\ObjectStore; + +/** + * Shared configuration between ConnectionTrait and ObjectTrait to ensure both to be in sync + */ +trait S3ConfigTrait { + protected array $params; + + protected string $bucket; + + protected int $timeout; + + protected string $proxy; + + protected string $storageClass; + + protected int $uploadPartSize; + + private int $putSizeLimit; + + private int $copySizeLimit; + + private bool $useMultipartCopy = true; +} diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index a1edfa1eb99..2720902fa85 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -44,39 +44,13 @@ use OCP\ICertificateManager; use Psr\Log\LoggerInterface; trait S3ConnectionTrait { - /** @var array */ - protected $params; + use S3ConfigTrait; - /** @var S3Client */ - protected $connection; + protected string $id; - /** @var string */ - protected $id; + protected ?S3Client $connection; - /** @var string */ - protected $bucket; - - /** @var int */ - protected $timeout; - - /** @var string */ - protected $proxy; - - /** @var string */ - protected $storageClass; - - /** @var int */ - protected $uploadPartSize; - - /** @var int */ - private $putSizeLimit; - - /** @var int */ - private $copySizeLimit; - - private bool $useMultipartCopy = true; - - protected $test; + protected bool $test; protected function parseParams($params) { if (empty($params['bucket'])) { diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 623c4d08c74..3019805389d 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -36,6 +36,8 @@ use OC\Files\Stream\SeekableHttpStream; use Psr\Http\Message\StreamInterface; trait S3ObjectTrait { + use S3ConfigTrait; + /** * Returns the connection * |