Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor 28 generic s3 #45

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/vendor/
/.vscode/
.phpunit.result.cache
tests/chunk.php
tests/chunk.php
/.idea

2 changes: 1 addition & 1 deletion src/Storage/Device.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract public function getRoot(): string;
* Each device hold a complex directory structure that is being build in this method.
*
* @param string $filename
* @param string $prefix
* @param string|null $prefix
*
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

use Utopia\Storage\Device\S3;

class BackBlaze extends S3

class Backblaze extends S3
{
/**
* Regions constants
Expand All @@ -20,7 +21,7 @@ class BackBlaze extends S3
const EU_CENTRAL_004 = 'eu-central-004';

/**
* BackBlaze Constructor
* Backblaze Constructor
*
* @param string $root
* @param string $accessKey
Expand All @@ -31,23 +32,23 @@ class BackBlaze extends S3
*/
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::US_WEST_004, string $acl = self::ACL_PRIVATE)
{
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl);
$this->headers['host'] = $bucket . '.' . 's3' . '.' . $region . '.backblazeb2.com';
$hostName = $bucket . '.' . 's3' . '.' . $region . '.backblazeb2.com';
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl, $hostName);
}

/**
* @return string
*/
public function getName(): string
{
return 'BackBlaze B2 Storage';
return 'Backblaze B2 Storage';
}

/**
* @return string
*/
public function getDescription(): string
{
return 'BackBlaze B2 Storage';
return 'Backblaze B2 Storage';
}
}
5 changes: 3 additions & 2 deletions src/Storage/Device/DOSpaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Utopia\Storage\Device\S3;


class DOSpaces extends S3
{
/**
Expand All @@ -29,8 +30,8 @@ class DOSpaces extends S3
*/
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::NYC3, string $acl = self::ACL_PRIVATE)
{
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl);
$this->headers['host'] = $bucket . '.' . $region . '.digitaloceanspaces.com';
$hostName = $bucket . '.' . $region . '.digitaloceanspaces.com';
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl, $hostName);
}

/**
Expand Down
13 changes: 7 additions & 6 deletions src/Storage/Device/Linode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

use Utopia\Storage\Device\S3;


class Linode extends S3
{
/**
* Regions constants
*
*/
const EU_CENTRAL_1='eu-central-1';
const US_SOUTHEAST_1='us-southeast-1';
const US_EAST_1='us-east-1';
const AP_SOUTH_1='ap-south-1';
const EU_CENTRAL_1 = 'eu-central-1';
const US_SOUTHEAST_1 = 'us-southeast-1';
const US_EAST_1 = 'us-east-1';
const AP_SOUTH_1 = 'ap-south-1';


/**
Expand All @@ -28,8 +29,8 @@ class Linode extends S3
*/
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::EU_CENTRAL_1, string $acl = self::ACL_PRIVATE)
{
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl);
$this->headers['host'] = $bucket.'.'.$region.'.'.'linodeobjects.com';
$hostName = $bucket.'.'.$region.'.linodeobjects.com';
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl, $hostName);
}

/**
Expand Down
Loading