classes/Cloud/Storage/Driver/S3/S3Storage.php
protected function getS3Client($region = false, $errorCollector = null) {
		if(!$this->enabled()) {
			return null;
		}

		if(empty($region)) {
			if(empty($this->region)) {
				$this->region = $this->getBucketRegion();
				if(empty($this->region)) {
                    if ($errorCollector) {
                        $errorCollector->addError('Could not determine region.');
                    }

					Logger::info("Could not get region from server.");

					return null;
				}

				update_option('ilab-media-s3-region', $this->region);
			}

			$region = $this->region;
		}

		if(empty($region)) {
            if ($errorCollector) {
                $errorCollector->addError("Could not determine region or the region was not specified.");
            }

			return null;
		}

		$config = [
			'version' => 'latest',
			'credentials' => [
				'key' => $this->key,
				'secret' => $this->secret
			],
			'region' => $region
		];

		if(!empty($this->endpoint)) {
			$config['endpoint'] = $this->endpoint;
			if($this->endPointPathStyle) {
				$config['use_path_style_endpoint'] = true;
			}
		}

		if($this->useTransferAcceleration) {
			$config['use_accelerate_endpoint'] = true;
		}

		$s3 = new S3Client($config);

		return $s3;
	}
protected function getS3Client($region = false, $errorCollector = null) {
		if(!$this->enabled()) {
			return null;
		}

		if(empty($region)) {
			if(empty($this->region)) {
				$this->region = $this->getBucketRegion();
				if(empty($this->region)) {
                    if ($errorCollector) {
                        $errorCollector->addError('Could not determine region.');
                    }

					Logger::info("Could not get region from server.");

					return null;
				}

				update_option('ilab-media-s3-region', $this->region);
			}

			$region = $this->region;
		}

		if(empty($region)) {
            if ($errorCollector) {
                $errorCollector->addError("Could not determine region or the region was not specified.");
            }

			return null;
		}

		$config = [
			'version' => 'latest',
			'credentials' => [
				'key' => $this->key,
				'secret' => $this->secret
			],
			'region' => $region
		];

		if(!empty($this->endpoint)) {
			$config['endpoint'] = $this->endpoint;
			if($this->endPointPathStyle) {
				$config['use_path_style_endpoint'] = true;
			}
		}

		if($this->useTransferAcceleration) {
			$config['use_accelerate_endpoint'] = true;
		}

		$s3 = new S3Client($config);

		return $s3;
	}
protected function getS3Client ( $ region = false , $ errorCollector = null ) { if ( ! $ this -> enabled ( ) ) { return null ; } if ( empty ( $ region ) ) { if ( empty ( $ this -> region ) ) { $ this -> region = $ this -> getBucketRegion ( ) ; if ( empty ( $ this -> region ) ) { if ( $ errorCollector ) { $ errorCollector -> addError ( 'Could not determine region.' ) ; } Logger :: info ( "Could not get region from server." ) ; return null ; } update_option ( 'ilab-media-s3-region' , $ this -> region ) ; } $ region = $ this -> region ; } if ( empty ( $ region ) ) { if ( $ errorCollector ) { $ errorCollector -> addError ( "Could not determine region or the region was not specified." ) ; } return null ; } $ config = [ 'version' => 'latest' , 'credentials' => [ 'key' => $ this -> key , 'secret' => $ this -> secret ] , 'region' => $ region ] ; if ( ! empty ( $ this -> endpoint ) ) { $ config [ 'endpoint' ] = $ this -> endpoint ; if ( $ this -> endPointPathStyle ) { $ config [ 'use_path_style_endpoint' ] = true ; } } if ( $ this -> useTransferAcceleration ) { $ config [ 'use_accelerate_endpoint' ] = true ; } $ s3 = new S3Client ( $ config ) ; return $ s3 ; }
Attempts to build the S3Client.  This requires a region be defined or determinable.

@param bool $region
@param ErrorCollector|null $errorCollector

@return S3Client|null
Attempts to build the S3Client . This requires a region be defined or determinable .