Skip to content
This repository was archived by the owner on May 8, 2024. It is now read-only.

Commit 1923fd4

Browse files
authored
Merge pull request #104 from XiaoningLiu/0.19.0
2017.09 - version 0.19.0
2 parents e3986ce + 29a9329 commit 1923fd4

File tree

221 files changed

+1797
-797
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+1797
-797
lines changed

BreakingChanges.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
Tracking Breaking changes in 0.19.0
2+
3+
Blob
4+
* Populate content MD5 for range gets on Blobs.
5+
- `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getContentMD5()` will always return the value of the whole blob’s MD5 value.
6+
- Added `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getRangeContentMD5()` to get MD5 of a blob range.
7+
* `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions` and `MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions` now provide `setRange()` and `getRange()` to accept a `MicrosoftAzure\Storage\Common\Models\Range` object. Following methods are removed:
8+
- `setRangeStart()`
9+
- `getRangeStart()`
10+
- `setRangeEnd()`
11+
- `getRangeEnd()`
12+
* Renamed 2 methods inside `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions`:
13+
- `getComputeRangeMD5()` -> `getRangeGetContentMD5()`
14+
- `setComputeRangeMD5()` -> `setRangeGetContentMD5()`
15+
16+
File
17+
* Populate content MD5 for range gets on Files.
18+
- `MicrosoftAzure\Storage\File\Models\FileProperties::getContentMD5()` will always return the value of the whole file’s MD5 value.
19+
- Added `MicrosoftAzure\Storage\File\Models\FileProperties::getRangeContentMD5()` to get MD5 of a file range.
20+
121
Tracking Breaking changes in 0.17.0
222

323
All

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ You can use the following commands to run tests:
4747
* One particular test case: ``phpunit -c phpunit.dist.xml --filter <case name>`` or ``phpunit -c phpunit.functional.dist.xml --filter <case name>``
4848

4949
### Testing Features
50-
As you develop a feature, you'll need to write tests to ensure quality. Your changes should be covered by both unit tests and functional tests. The unit tests and functional tests codes should be placed under tests/unit and tests/functional respectively. You should also run existing tests related to your change to address any unexpected breaks.
50+
As you develop a feature, you'll need to write tests to ensure quality. Your changes should be covered by both unit tests and functional tests. The unit tests and functional tests codes should be placed under tests/Unit and tests/Functional respectively. You should also run existing tests related to your change to address any unexpected breaks.
5151

5252
## Pull Requests
5353

ChangeLog.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,42 @@
1+
2017.09 - version 0.19.0
2+
3+
ALL
4+
* Fixed wrong `XmlSerializer` in ServiceException.php.
5+
* Fixed formatting of non-UTC dates when using instances of `DateTime` to generate shared access signatures.
6+
* Fixed class loading errors on case-sensitive file systems when testing.
7+
8+
Blob
9+
* Added `CopyBlobFromURL` to support copy blob from a source URL including resources in other storage accounts.
10+
* Added support for Incremental Copy Page Blob. This allows efficient copying and backup of page blob snapshots.
11+
* Fixed a bug that `BlobRestProxy::createPageBlobFromContent` cannot work.
12+
* Populate content MD5 for range gets on Blobs.
13+
- `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getContentMD5()` will always return the value of the whole blob’s MD5 value.
14+
- Added `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getRangeContentMD5()` to get MD5 of a blob range.
15+
* Renamed 2 methods inside `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions`:
16+
- `getComputeRangeMD5()` -> `getRangeGetContentMD5()`
17+
- `setComputeRangeMD5()` -> `setRangeGetContentMD5()`
18+
* The public access level of a container is now returned from the List Containers and Get Container Properties APIs.
19+
* `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions` and `MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions` now provide `setRange()` and `getRange()` to accept a `MicrosoftAzure\Storage\Common\Models\Range` object. Following methods are removed:
20+
- `setRangeStart()`
21+
- `getRangeStart()`
22+
- `setRangeEnd()`
23+
- `getRangeEnd()`
24+
25+
Queue
26+
* The `QueueRestProxy::createMessage` now returns information about the message that was just added, including the pop receipt.
27+
28+
File
29+
* Fixed a bug that setting content MD5 cannot work when creating files.
30+
* Option parameter `ListDirectoriesAndFilesOptions` of `FileRestProxy::listDirectoriesAndFiles` is now able to set a prefix which limits the listing to a specified prefix.
31+
* Populate content MD5 for range gets on Files.
32+
- `MicrosoftAzure\Storage\File\Models\FileProperties::getContentMD5()` will always return the value of the whole file’s MD5 value.
33+
- Added `MicrosoftAzure\Storage\File\Models\FileProperties::getRangeContentMD5()` to get MD5 of a file range.
34+
135
2017.08 - version 0.18.0
236

337
All
438
* Updated `SharedAccessSignatureHelper` to accept `Datetime` type as `signedExpiry` or `signedStart` parameter when generating SAS tokens.
5-
* Added samples under samples foder to generate account level or service level SAS tokens with `SharedAccessSignatureHelper`.
39+
* Added samples under the samples folder to generate account level or service level SAS tokens with `SharedAccessSignatureHelper`.
640
* Fixed wrong PHPUnit `@covers` tags in unit and functional test.
741
* Removed unused imports declarations.
842

phpunit.functional.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
verbose="true">
99
<testsuites>
1010
<testsuite name="azure-storage-php">
11-
<directory suffix="Test.php">tests/functional/</directory>
11+
<directory suffix="Test.php">tests/Functional/</directory>
1212
</testsuite>
1313
</testsuites>
1414

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
verbose="true">
99
<testsuites>
1010
<testsuite name="azure-storage-php">
11-
<directory suffix="Test.php">tests/unit</directory>
11+
<directory suffix="Test.php">tests/Unit</directory>
1212
</testsuite>
1313
</testsuites>
1414

samples/BlobSamples.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions;
3131
use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
3232
use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions;
33-
use MicrosoftAzure\Storage\Blob\Models\ContainerAcl;
33+
use MicrosoftAzure\Storage\Blob\Models\ContainerACL;
3434
use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions;
3535
use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions;
3636
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
@@ -234,7 +234,7 @@ function containerAcl($blobClient)
234234
// Set container ACL
235235
$past = new \DateTime("01/01/2010");
236236
$future = new \DateTime("01/01/2020");
237-
$acl = new ContainerAcl();
237+
$acl = new ContainerACL();
238238
$acl->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS);
239239
$acl->addSignedIdentifier('123', $past, $future, 'rw');
240240
$blobClient->setContainerACL($container, $acl);
@@ -519,8 +519,7 @@ function pageBlobOperations($blobClient)
519519
);
520520
# List page blob ranges
521521
$listPageBlobRangesOptions = new ListPageBlobRangesOptions();
522-
$listPageBlobRangesOptions->setRangeStart(0);
523-
$listPageBlobRangesOptions->setRangeEnd(1023);
522+
$listPageBlobRangesOptions->setRange(new Range(0, 1023));
524523
echo "List Page Blob Ranges".PHP_EOL;
525524
$listPageBlobRangesResult = $blobClient->listPageBlobRanges(
526525
$containerName,
@@ -531,8 +530,7 @@ function pageBlobOperations($blobClient)
531530
foreach ($listPageBlobRangesResult->getRanges() as $range) {
532531
echo "Range:".$range->getStart()."-".$range->getEnd().PHP_EOL;
533532
$getBlobOptions = new GetBlobOptions();
534-
$getBlobOptions->setRangeStart($range->getStart());
535-
$getBlobOptions->setRangeEnd($range->getEnd());
533+
$getBlobOptions->setRange($range);
536534
$getBlobResult = $blobClient->getBlob($containerName, $blobName, $getBlobOptions);
537535
file_put_contents("PageContent.txt", $getBlobResult->getContentStream());
538536
}

samples/TableSamples.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
use MicrosoftAzure\Storage\Common\SharedAccessSignatureHelper;
4141

4242
$connectionString = 'DefaultEndpointsProtocol=https;AccountName=<yourAccount>;AccountKey=<yourKey>';
43-
$connectionString = 'DefaultEndpointsProtocol=https;AccountName=browserifytest;AccountKey=AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=browserifytest;AccountKey=bzcVslAQI9EaR4R0HN78Rs4rjKotuAvCTto9rRlEcpVtVXt0gxzxv/ky4IQkX3N9xN7iAXLzYWn5Yk+5jYkBLg==';
4443
$tableClient = ServicesBuilder::getInstance()->createTableService($connectionString);
4544

4645
$mytable = 'mytable';

src/Blob/BlobRestProxy.php

Lines changed: 121 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,10 @@ public function createPageBlobFromContentAsync(
16611661
$body = Psr7\stream_for($content);
16621662
$self = $this;
16631663

1664+
if (is_null($options)) {
1665+
$options = new CreateBlobOptions();
1666+
}
1667+
16641668
$createBlobPromise = $this->createPageBlobAsync(
16651669
$container,
16661670
$blob,
@@ -2014,7 +2018,7 @@ private function uploadPageBlobAsync(
20142018
return $this->sendConcurrentAsync(
20152019
$generator,
20162020
Resources::STATUS_CREATED,
2017-
$options->getRequestOptions()
2021+
$options
20182022
);
20192023
}
20202024

@@ -3045,13 +3049,16 @@ private function listPageBlobRangesAsyncImpl(
30453049
$headers,
30463050
$options->getAccessConditions()
30473051
);
3048-
3049-
$headers = $this->addOptionalRangeHeader(
3050-
$headers,
3051-
$options->getRangeStart(),
3052-
$options->getRangeEnd()
3053-
);
3054-
3052+
3053+
$range = $options->getRange();
3054+
if ($range) {
3055+
$headers = $this->addOptionalRangeHeader(
3056+
$headers,
3057+
$range->getStart(),
3058+
$range->getEnd()
3059+
);
3060+
}
3061+
30553062
$this->addOptionalHeader(
30563063
$headers,
30573064
Resources::X_MS_LEASE_ID,
@@ -3455,16 +3462,20 @@ public function getBlobAsync(
34553462
$options = new GetBlobOptions();
34563463
}
34573464

3458-
$getMD5 = $options->getComputeRangeMD5();
3465+
$getMD5 = $options->getRangeGetContentMD5();
34593466
$headers = $this->addOptionalAccessConditionHeader(
34603467
$headers,
34613468
$options->getAccessConditions()
34623469
);
3463-
$headers = $this->addOptionalRangeHeader(
3464-
$headers,
3465-
$options->getRangeStart(),
3466-
$options->getRangeEnd()
3467-
);
3470+
3471+
$range = $options->getRange();
3472+
if ($range) {
3473+
$headers = $this->addOptionalRangeHeader(
3474+
$headers,
3475+
$range->getStart(),
3476+
$range->getEnd()
3477+
);
3478+
}
34683479

34693480
$this->addOptionalHeader(
34703481
$headers,
@@ -3744,6 +3755,82 @@ public function copyBlobAsync(
37443755
$sourceContainer,
37453756
$sourceBlob,
37463757
Models\CopyBlobOptions $options = null
3758+
) {
3759+
if (is_null($options)) {
3760+
$options = new CopyBlobOptions();
3761+
}
3762+
3763+
$sourceBlobPath = $this->getCopyBlobSourceName(
3764+
$sourceContainer,
3765+
$sourceBlob,
3766+
$options
3767+
);
3768+
3769+
return $this->copyBlobFromURLAsync(
3770+
$destinationContainer,
3771+
$destinationBlob,
3772+
$sourceBlobPath,
3773+
$options
3774+
);
3775+
}
3776+
3777+
/**
3778+
* Copies from a source URL to a destination blob.
3779+
*
3780+
* @param string $destinationContainer name of the
3781+
* destination
3782+
* container
3783+
* @param string $destinationBlob name of the
3784+
* destination
3785+
* blob
3786+
* @param string $sourceURL URL of the
3787+
* source
3788+
* resource
3789+
* @param Models\CopyBlobFromURLOptions $options optional
3790+
* parameters
3791+
*
3792+
* @return Models\CopyBlobResult
3793+
*
3794+
* @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
3795+
*/
3796+
public function copyBlobFromURL(
3797+
$destinationContainer,
3798+
$destinationBlob,
3799+
$sourceURL,
3800+
Models\CopyBlobFromURLOptions $options = null
3801+
) {
3802+
return $this->copyBlobFromURLAsync(
3803+
$destinationContainer,
3804+
$destinationBlob,
3805+
$sourceURL,
3806+
$options
3807+
)->wait();
3808+
}
3809+
3810+
/**
3811+
* Creates promise to copy from source URL to a destination blob.
3812+
*
3813+
* @param string $destinationContainer name of the
3814+
* destination
3815+
* container
3816+
* @param string $destinationBlob name of the
3817+
* destination
3818+
* blob
3819+
* @param string $sourceURL URL of the
3820+
* source
3821+
* resource
3822+
* @param Models\CopyBlobFromURLOptions $options optional
3823+
* parameters
3824+
*
3825+
* @return \GuzzleHttp\Promise\PromiseInterface
3826+
*
3827+
* @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
3828+
*/
3829+
public function copyBlobFromURLAsync(
3830+
$destinationContainer,
3831+
$destinationBlob,
3832+
$sourceURL,
3833+
Models\CopyBlobFromURLOptions $options = null
37473834
) {
37483835
$method = Resources::HTTP_PUT;
37493836
$headers = array();
@@ -3753,49 +3840,51 @@ public function copyBlobAsync(
37533840
$destinationContainer,
37543841
$destinationBlob
37553842
);
3756-
3843+
37573844
if (is_null($options)) {
3758-
$options = new CopyBlobOptions();
3845+
$options = new CopyBlobFromURLOptions();
37593846
}
3760-
3761-
$sourceBlobPath = $this->getCopyBlobSourceName(
3762-
$sourceContainer,
3763-
$sourceBlob,
3764-
$options
3765-
);
3766-
3847+
3848+
if ($options->getIsIncrementalCopy()) {
3849+
$this->addOptionalQueryParam(
3850+
$queryParams,
3851+
Resources::QP_COMP,
3852+
'incrementalcopy'
3853+
);
3854+
}
3855+
37673856
$headers = $this->addOptionalAccessConditionHeader(
37683857
$headers,
37693858
$options->getAccessConditions()
37703859
);
3771-
3860+
37723861
$headers = $this->addOptionalSourceAccessConditionHeader(
37733862
$headers,
37743863
$options->getSourceAccessConditions()
37753864
);
3776-
3865+
37773866
$this->addOptionalHeader(
37783867
$headers,
37793868
Resources::X_MS_COPY_SOURCE,
3780-
$sourceBlobPath
3869+
$sourceURL
37813870
);
3782-
3871+
37833872
$headers = $this->addMetadataHeaders($headers, $options->getMetadata());
3784-
3873+
37853874
$this->addOptionalHeader(
37863875
$headers,
37873876
Resources::X_MS_LEASE_ID,
37883877
$options->getLeaseId()
37893878
);
3790-
3879+
37913880
$this->addOptionalHeader(
37923881
$headers,
37933882
Resources::X_MS_SOURCE_LEASE_ID,
37943883
$options->getSourceLeaseId()
37953884
);
3796-
3885+
37973886
$options->setLocationMode(LocationMode::PRIMARY_ONLY);
3798-
3887+
37993888
return $this->sendAsync(
38003889
$method,
38013890
$headers,
@@ -3811,7 +3900,7 @@ public function copyBlobAsync(
38113900
);
38123901
}, null);
38133902
}
3814-
3903+
38153904
/**
38163905
* Abort a blob copy operation
38173906
*

0 commit comments

Comments
 (0)