@@ -25,71 +25,71 @@ |
||
25 | 25 | use OCP\Files\ObjectStore\IObjectStore; |
26 | 26 | |
27 | 27 | class Azure implements IObjectStore { |
28 | - /** @var string */ |
|
29 | - private $containerName; |
|
30 | - /** @var string */ |
|
31 | - private $accountName; |
|
32 | - /** @var string */ |
|
33 | - private $accountKey; |
|
34 | - /** @var BlobRestProxy|null */ |
|
35 | - private $blobClient = null; |
|
28 | + /** @var string */ |
|
29 | + private $containerName; |
|
30 | + /** @var string */ |
|
31 | + private $accountName; |
|
32 | + /** @var string */ |
|
33 | + private $accountKey; |
|
34 | + /** @var BlobRestProxy|null */ |
|
35 | + private $blobClient = null; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param array $parameters |
|
39 | - */ |
|
40 | - public function __construct($parameters) { |
|
41 | - $this->containerName = $parameters['container']; |
|
42 | - $this->accountName = $parameters['account_name']; |
|
43 | - $this->accountKey = $parameters['account_key']; |
|
44 | - } |
|
37 | + /** |
|
38 | + * @param array $parameters |
|
39 | + */ |
|
40 | + public function __construct($parameters) { |
|
41 | + $this->containerName = $parameters['container']; |
|
42 | + $this->accountName = $parameters['account_name']; |
|
43 | + $this->accountKey = $parameters['account_key']; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @return BlobRestProxy |
|
48 | - */ |
|
49 | - private function getBlobClient() { |
|
50 | - if (!$this->blobClient) { |
|
51 | - $connectionString = "DefaultEndpointsProtocol=https;AccountName=" . $this->accountName . ";AccountKey=" . $this->accountKey; |
|
52 | - $this->blobClient = BlobRestProxy::createBlobService($connectionString); |
|
53 | - } |
|
54 | - return $this->blobClient; |
|
55 | - } |
|
46 | + /** |
|
47 | + * @return BlobRestProxy |
|
48 | + */ |
|
49 | + private function getBlobClient() { |
|
50 | + if (!$this->blobClient) { |
|
51 | + $connectionString = "DefaultEndpointsProtocol=https;AccountName=" . $this->accountName . ";AccountKey=" . $this->accountKey; |
|
52 | + $this->blobClient = BlobRestProxy::createBlobService($connectionString); |
|
53 | + } |
|
54 | + return $this->blobClient; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return string the container or bucket name where objects are stored |
|
59 | - * @since 7.0.0 |
|
60 | - */ |
|
61 | - public function getStorageId() { |
|
62 | - return 'azure::blob::' . $this->containerName; |
|
63 | - } |
|
57 | + /** |
|
58 | + * @return string the container or bucket name where objects are stored |
|
59 | + * @since 7.0.0 |
|
60 | + */ |
|
61 | + public function getStorageId() { |
|
62 | + return 'azure::blob::' . $this->containerName; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @param string $urn the unified resource name used to identify the object |
|
67 | - * @return resource stream with the read data |
|
68 | - * @throws \Exception when something goes wrong, message will be logged |
|
69 | - * @since 7.0.0 |
|
70 | - */ |
|
71 | - public function readObject($urn) { |
|
72 | - $blob = $this->getBlobClient()->getBlob($this->containerName, $urn); |
|
73 | - return $blob->getContentStream(); |
|
74 | - } |
|
65 | + /** |
|
66 | + * @param string $urn the unified resource name used to identify the object |
|
67 | + * @return resource stream with the read data |
|
68 | + * @throws \Exception when something goes wrong, message will be logged |
|
69 | + * @since 7.0.0 |
|
70 | + */ |
|
71 | + public function readObject($urn) { |
|
72 | + $blob = $this->getBlobClient()->getBlob($this->containerName, $urn); |
|
73 | + return $blob->getContentStream(); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @param string $urn the unified resource name used to identify the object |
|
78 | - * @param resource $stream stream with the data to write |
|
79 | - * @throws \Exception when something goes wrong, message will be logged |
|
80 | - * @since 7.0.0 |
|
81 | - */ |
|
82 | - public function writeObject($urn, $stream) { |
|
83 | - $this->getBlobClient()->createBlockBlob($this->containerName, $urn, $stream); |
|
84 | - } |
|
76 | + /** |
|
77 | + * @param string $urn the unified resource name used to identify the object |
|
78 | + * @param resource $stream stream with the data to write |
|
79 | + * @throws \Exception when something goes wrong, message will be logged |
|
80 | + * @since 7.0.0 |
|
81 | + */ |
|
82 | + public function writeObject($urn, $stream) { |
|
83 | + $this->getBlobClient()->createBlockBlob($this->containerName, $urn, $stream); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @param string $urn the unified resource name used to identify the object |
|
88 | - * @return void |
|
89 | - * @throws \Exception when something goes wrong, message will be logged |
|
90 | - * @since 7.0.0 |
|
91 | - */ |
|
92 | - public function deleteObject($urn) { |
|
93 | - $this->getBlobClient()->deleteBlob($this->containerName, $urn); |
|
94 | - } |
|
86 | + /** |
|
87 | + * @param string $urn the unified resource name used to identify the object |
|
88 | + * @return void |
|
89 | + * @throws \Exception when something goes wrong, message will be logged |
|
90 | + * @since 7.0.0 |
|
91 | + */ |
|
92 | + public function deleteObject($urn) { |
|
93 | + $this->getBlobClient()->deleteBlob($this->containerName, $urn); |
|
94 | + } |
|
95 | 95 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | private function getBlobClient() { |
50 | 50 | if (!$this->blobClient) { |
51 | - $connectionString = "DefaultEndpointsProtocol=https;AccountName=" . $this->accountName . ";AccountKey=" . $this->accountKey; |
|
51 | + $connectionString = "DefaultEndpointsProtocol=https;AccountName=".$this->accountName.";AccountKey=".$this->accountKey; |
|
52 | 52 | $this->blobClient = BlobRestProxy::createBlobService($connectionString); |
53 | 53 | } |
54 | 54 | return $this->blobClient; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @since 7.0.0 |
60 | 60 | */ |
61 | 61 | public function getStorageId() { |
62 | - return 'azure::blob::' . $this->containerName; |
|
62 | + return 'azure::blob::'.$this->containerName; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |