diff --git a/core/src/plugins/access.s3/S3AccessDriver.php b/core/src/plugins/access.s3/S3AccessDriver.php index ac755d7c0b..f2ff274ddf 100644 --- a/core/src/plugins/access.s3/S3AccessDriver.php +++ b/core/src/plugins/access.s3/S3AccessDriver.php @@ -92,10 +92,11 @@ protected function initRepository(ContextInterface $contextInterface) } /** + * @param ContextInterface $ctx * @return S3Client */ - public function getS3Service(){ - return $this->s3Client; + public function getS3Service(ContextInterface $ctx){ + return S3AccessWrapper::getClientForContext($ctx); } /** @@ -103,7 +104,7 @@ public function getS3Service(){ * @return int */ public function directoryUsage(AJXP_Node $node){ - $client = $this->getS3Service(); + $client = $this->getS3Service($node->getContext()); $bucket = $node->getRepository()->getContextOption($node->getContext(), "CONTAINER"); //(isSet($repositoryResolvedOptions["CONTAINER"])?$repositoryResolvedOptions["CONTAINER"]:$this->repository->getOption("CONTAINER")); $path = rtrim($node->getRepository()->getContextOption($node->getContext(), "PATH"), "/").$node->getPath(); //(isSet($repositoryResolvedOptions["PATH"])?$repositoryResolvedOptions["PATH"]:""); $objects = $client->getIterator('ListObjects', array( diff --git a/core/src/plugins/access.s3/S3AccessWrapper.php b/core/src/plugins/access.s3/S3AccessWrapper.php index 2d775050c2..49ac869f96 100644 --- a/core/src/plugins/access.s3/S3AccessWrapper.php +++ b/core/src/plugins/access.s3/S3AccessWrapper.php @@ -72,7 +72,7 @@ public static function getResolvedOptionsForNode($node) * @param boolean $registerStream * @return S3Client */ - protected static function getClientForContext(ContextInterface $ctx, $registerStream = true) + public static function getClientForContext(ContextInterface $ctx, $registerStream = true) { $repoObject = $ctx->getRepository(); if (!isSet(self::$clients[$repoObject->getId()])) { diff --git a/core/src/plugins/metastore.s3/S3MetaStore.php b/core/src/plugins/metastore.s3/S3MetaStore.php index bf4dbd6446..b6b386538f 100644 --- a/core/src/plugins/metastore.s3/S3MetaStore.php +++ b/core/src/plugins/metastore.s3/S3MetaStore.php @@ -66,12 +66,13 @@ protected function getUserId($node) } /** + * @param ContextInterface $ctx * @return \aws\S3\S3Client */ protected function getAwsService(ContextInterface $ctx) { if(method_exists($ctx->getRepository()->getDriverInstance($ctx), "getS3Service")){ - return $ctx->getRepository()->getDriverInstance($ctx)->getS3Service(); + return $ctx->getRepository()->getDriverInstance($ctx)->getS3Service($ctx); } return null; }