mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-20 05:13:42 -07:00
v2: Updates
* Simplifies & beautifies everything * Introduces a new Class system. * Errors are defaulted to AWS's handler. * New function names & more efficient handling. * Should fix a majority of the errors. Please read the README for more!
This commit is contained in:
parent
ad0726e41e
commit
e6d7753dc8
1095 changed files with 45088 additions and 2911 deletions
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Aws\S3;
|
||||
|
||||
use Aws\Arn\ArnParser;
|
||||
use Aws\Multipart\AbstractUploadManager;
|
||||
use Aws\ResultInterface;
|
||||
use GuzzleHttp\Psr7;
|
||||
|
@ -50,19 +52,25 @@ class MultipartCopy extends AbstractUploadManager
|
|||
* result of executing a HeadObject command on the copy source.
|
||||
*
|
||||
* @param S3ClientInterface $client Client used for the upload.
|
||||
* @param string $source Location of the data to be copied
|
||||
* @param string $source Location of the data to be copied
|
||||
* (in the form /<bucket>/<key>).
|
||||
* @param array $config Configuration used to perform the upload.
|
||||
* @param array $config Configuration used to perform the upload.
|
||||
*/
|
||||
public function __construct(
|
||||
S3ClientInterface $client,
|
||||
$source,
|
||||
array $config = []
|
||||
) {
|
||||
$this->source = '/' . ltrim($source, '/');
|
||||
parent::__construct($client, array_change_key_case($config) + [
|
||||
'source_metadata' => null
|
||||
]);
|
||||
if (ArnParser::isArn($source)) {
|
||||
$this->source = '';
|
||||
} else {
|
||||
$this->source = "/";
|
||||
}
|
||||
$this->source .= ltrim($source, '/');
|
||||
parent::__construct(
|
||||
$client,
|
||||
array_change_key_case($config) + ['source_metadata' => null]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,12 +88,12 @@ class MultipartCopy extends AbstractUploadManager
|
|||
return [
|
||||
'command' => [
|
||||
'initiate' => 'CreateMultipartUpload',
|
||||
'upload' => 'UploadPartCopy',
|
||||
'upload' => 'UploadPartCopy',
|
||||
'complete' => 'CompleteMultipartUpload',
|
||||
],
|
||||
'id' => [
|
||||
'bucket' => 'Bucket',
|
||||
'key' => 'Key',
|
||||
'bucket' => 'Bucket',
|
||||
'key' => 'Key',
|
||||
'upload_id' => 'UploadId',
|
||||
],
|
||||
'part_num' => 'PartNumber',
|
||||
|
@ -101,8 +109,7 @@ class MultipartCopy extends AbstractUploadManager
|
|||
if (!$this->state->hasPartBeenUploaded($partNumber)) {
|
||||
$command = $this->client->getCommand(
|
||||
$this->info['command']['upload'],
|
||||
$this->createPart($partNumber, $parts)
|
||||
+ $this->getState()->getId()
|
||||
$this->createPart($partNumber, $parts) + $this->getState()->getId()
|
||||
);
|
||||
$command->getHandlerList()->appendSign($resultHandler, 'mup');
|
||||
yield $command;
|
||||
|
@ -121,7 +128,13 @@ class MultipartCopy extends AbstractUploadManager
|
|||
$data[$k] = $v;
|
||||
}
|
||||
|
||||
$data['CopySource'] = $this->source;
|
||||
list($bucket, $key) = explode('/', ltrim($this->source, '/'), 2);
|
||||
$data['CopySource'] = '/' . $bucket . '/' . rawurlencode(
|
||||
implode(
|
||||
'/',
|
||||
array_map('urlencode', explode('/', $key))
|
||||
)
|
||||
);
|
||||
$data['PartNumber'] = $partNumber;
|
||||
|
||||
$defaultPartSize = $this->determinePartSize();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue