Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix getS3Service() method
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Dec 8, 2017
1 parent 10406ae commit c63bc35
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions core/src/plugins/access.s3/S3AccessDriver.php
Expand Up @@ -92,18 +92,19 @@ 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);
}

/**
* @param AJXP_Node $node
* @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(
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/access.s3/S3AccessWrapper.php
Expand Up @@ -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()])) {
Expand Down
3 changes: 2 additions & 1 deletion core/src/plugins/metastore.s3/S3MetaStore.php
Expand Up @@ -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;
}
Expand Down

0 comments on commit c63bc35

Please sign in to comment.