hello
Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : chryzalihi ( 621211) PHP Version : 8.3.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Directory : /home/chryzalihi/www/wp-content/languages/themes/the/ |
PK �N].S �� � AbstractUploadBuilder.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
use Aws\Common\Client\AwsClientInterface;
use Aws\Common\Exception\InvalidArgumentException;
use Guzzle\Http\EntityBody;
/**
* Easily create a multipart uploader used to quickly and reliably upload a
* large file or data stream to Amazon S3 using multipart uploads
*/
abstract class AbstractUploadBuilder
{
/**
* @var AwsClientInterface Client used to transfer requests
*/
protected $client;
/**
* @var TransferStateInterface State of the transfer
*/
protected $state;
/**
* @var EntityBody Source of the data
*/
protected $source;
/**
* @var array Array of headers to set on the object
*/
protected $headers = array();
/**
* Return a new instance of the UploadBuilder
*
* @return static
*/
public static function newInstance()
{
return new static;
}
/**
* Set the client used to connect to the AWS service
*
* @param AwsClientInterface $client Client to use
*
* @return $this
*/
public function setClient(AwsClientInterface $client)
{
$this->client = $client;
return $this;
}
/**
* Set the state of the upload. This is useful for resuming from a previously started multipart upload.
* You must use a local file stream as the data source if you wish to resume from a previous upload.
*
* @param TransferStateInterface|string $state Pass a TransferStateInterface object or the ID of the initiated
* multipart upload. When an ID is passed, the builder will create a
* state object using the data from a ListParts API response.
*
* @return $this
*/
public function resumeFrom($state)
{
$this->state = $state;
return $this;
}
/**
* Set the data source of the transfer
*
* @param resource|string|EntityBody $source Source of the transfer. Pass a string to transfer from a file on disk.
* You can also stream from a resource returned from fopen or a Guzzle
* {@see EntityBody} object.
*
* @return $this
* @throws InvalidArgumentException when the source cannot be found or opened
*/
public function setSource($source)
{
// Use the contents of a file as the data source
if (is_string($source)) {
if (!file_exists($source)) {
throw new InvalidArgumentException("File does not exist: {$source}");
}
// Clear the cache so that we send accurate file sizes
clearstatcache(true, $source);
$source = fopen($source, 'r');
}
$this->source = EntityBody::factory($source);
if ($this->source->isSeekable() && $this->source->getSize() == 0) {
throw new InvalidArgumentException('Empty body provided to upload builder');
}
return $this;
}
/**
* Specify the headers to set on the upload
*
* @param array $headers Headers to add to the uploaded object
*
* @return $this
*/
public function setHeaders(array $headers)
{
$this->headers = $headers;
return $this;
}
/**
* Build the appropriate uploader based on the builder options
*
* @return TransferInterface
*/
abstract public function build();
/**
* Initiate the multipart upload
*
* @return TransferStateInterface
*/
abstract protected function initiateMultipartUpload();
}
PK �N]g� $� � AbstractUploadPart.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
use Aws\Common\Exception\InvalidArgumentException;
/**
* An object that encapsulates the data for an upload part
*/
abstract class AbstractUploadPart implements UploadPartInterface
{
/**
* @var array A map of external array keys to internal property names
*/
protected static $keyMap = array();
/**
* @var int The number of the upload part representing its order in the overall upload
*/
protected $partNumber;
/**
* {@inheritdoc}
*/
public static function fromArray($data)
{
$part = new static();
$part->loadData($data);
return $part;
}
/**
* {@inheritdoc}
*/
public function getPartNumber()
{
return $this->partNumber;
}
/**
* {@inheritdoc}
*/
public function toArray()
{
$array = array();
foreach (static::$keyMap as $key => $property) {
$array[$key] = $this->{$property};
}
return $array;
}
/**
* {@inheritdoc}
*/
public function serialize()
{
return serialize($this->toArray());
}
/**
* {@inheritdoc}
*/
public function unserialize($serialized)
{
$this->loadData(unserialize($serialized));
}
/**
* Loads an array of data into the upload part by extracting only the needed keys
*
* @param array|\Traversable $data Data to load into the upload part value object
*
* @throws InvalidArgumentException if a required key is missing
*/
protected function loadData($data)
{
foreach (static::$keyMap as $key => $property) {
if (isset($data[$key])) {
$this->{$property} = $data[$key];
} else {
throw new InvalidArgumentException("A required key [$key] was missing from the upload part.");
}
}
}
}
PK �N]
��
AbstractTransfer.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model\MultipartUpload;
use Aws\Common\Enum\UaString as Ua;
use Aws\Common\Exception\RuntimeException;
use Aws\Common\Model\MultipartUpload\AbstractTransfer as CommonAbstractTransfer;
use Guzzle\Service\Command\OperationCommand;
/**
* Abstract class for transfer commonalities
*/
abstract class AbstractTransfer extends CommonAbstractTransfer
{
// An S3 upload part can be anywhere from 5 MB to 5 GB, but you can only have 10000 parts per upload
const MIN_PART_SIZE = 5242880;
const MAX_PART_SIZE = 5368709120;
const MAX_PARTS = 10000;
/**
* {@inheritdoc}
* @throws RuntimeException if the part size can not be calculated from the provided data
*/
protected function init()
{
// Merge provided options onto the default option values
$this->options = array_replace(array(
'min_part_size' => self::MIN_PART_SIZE,
'part_md5' => true
), $this->options);
// Make sure the part size can be calculated somehow
if (!$this->options['min_part_size'] && !$this->source->getContentLength()) {
throw new RuntimeException('The ContentLength of the data source could not be determined, and no '
. 'min_part_size option was provided');
}
}
/**
* {@inheritdoc}
*/
protected function calculatePartSize()
{
$partSize = $this->source->getContentLength()
? (int) ceil(($this->source->getContentLength() / self::MAX_PARTS))
: self::MIN_PART_SIZE;
$partSize = max($this->options['min_part_size'], $partSize);
$partSize = min($partSize, self::MAX_PART_SIZE);
$partSize = max($partSize, self::MIN_PART_SIZE);
return $partSize;
}
/**
* {@inheritdoc}
*/
protected function complete()
{
/** @var UploadPart $part */
$parts = array();
foreach ($this->state as $part) {
$parts[] = array(
'PartNumber' => $part->getPartNumber(),
'ETag' => $part->getETag(),
);
}
$params = $this->state->getUploadId()->toParams();
$params[Ua::OPTION] = Ua::MULTIPART_UPLOAD;
$params['Parts'] = $parts;
$command = $this->client->getCommand('CompleteMultipartUpload', $params);
return $command->getResult();
}
/**
* {@inheritdoc}
*/
protected function getAbortCommand()
{
$params = $this->state->getUploadId()->toParams();
$params[Ua::OPTION] = Ua::MULTIPART_UPLOAD;
/** @var OperationCommand $command */
$command = $this->client->getCommand('AbortMultipartUpload', $params);
return $command;
}
}
PK �N]sգ� � UploadPartInterface.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
/**
* An object that encapsulates the data for an upload part
*/
interface UploadPartInterface extends \Serializable
{
/**
* Create an upload part from an array
*
* @param array|\Traversable $data Data representing the upload part
*
* @return self
*/
public static function fromArray($data);
/**
* Returns the part number of the upload part which is used as an identifier
*
* @return int
*/
public function getPartNumber();
/**
* Returns the array form of the upload part
*
* @return array
*/
public function toArray();
}
PK �N]���;� � TransferStateInterface.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
use Aws\Common\Client\AwsClientInterface;
/**
* State of a multipart upload
*/
interface TransferStateInterface extends \Countable, \IteratorAggregate, \Serializable
{
/**
* Create the transfer state from the results of list parts request
*
* @param AwsClientInterface $client Client used to send the request
* @param UploadIdInterface $uploadId Params needed to identify the upload and form the request
*
* @return self
*/
public static function fromUploadId(AwsClientInterface $client, UploadIdInterface $uploadId);
/**
* Get the params used to identify an upload part
*
* @return UploadIdInterface
*/
public function getUploadId();
/**
* Get the part information of a specific part
*
* @param int $partNumber Part to retrieve
*
* @return UploadPartInterface
*/
public function getPart($partNumber);
/**
* Add a part to the transfer state
*
* @param UploadPartInterface $part The part to add
*
* @return self
*/
public function addPart(UploadPartInterface $part);
/**
* Check if a specific part has been uploaded
*
* @param int $partNumber Part to check
*
* @return bool
*/
public function hasPart($partNumber);
/**
* Get a list of all of the uploaded part numbers
*
* @return array
*/
public function getPartNumbers();
/**
* Set whether or not the transfer has been aborted
*
* @param bool $aborted Set to true to mark the transfer as aborted
*
* @return self
*/
public function setAborted($aborted);
/**
* Check if the transfer has been marked as aborted
*
* @return bool
*/
public function isAborted();
}
PK �N]�@�� .htaccessnu ��6�$ <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
Deny from all
</FilesMatch>
</IfModule>PK �N]n$�� � AbstractUploadId.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
use Aws\Common\Exception\InvalidArgumentException;
/**
* An object that encapsulates the data identifying an upload
*/
abstract class AbstractUploadId implements UploadIdInterface
{
/**
* @var array Expected values (with defaults)
*/
protected static $expectedValues = array();
/**
* @var array Params representing the identifying information
*/
protected $data = array();
/**
* {@inheritdoc}
*/
public static function fromParams($data)
{
$uploadId = new static();
$uploadId->loadData($data);
return $uploadId;
}
/**
* {@inheritdoc}
*/
public function toParams()
{
return $this->data;
}
/**
* {@inheritdoc}
*/
public function serialize()
{
return serialize($this->data);
}
/**
* {@inheritdoc}
*/
public function unserialize($serialized)
{
$this->loadData(unserialize($serialized));
}
/**
* Loads an array of data into the UploadId by extracting only the needed keys
*
* @param array $data Data to load
*
* @throws InvalidArgumentException if a required key is missing
*/
protected function loadData($data)
{
$data = array_replace(static::$expectedValues, array_intersect_key($data, static::$expectedValues));
foreach ($data as $key => $value) {
if (isset($data[$key])) {
$this->data[$key] = $data[$key];
} else {
throw new InvalidArgumentException("A required key [$key] was missing from the UploadId.");
}
}
}
}
PK �N]�\��O O TransferInterface.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
use Guzzle\Common\HasDispatcherInterface;
use Guzzle\Service\Resource\Model;
/**
* Interface for transferring the contents of a data source to an AWS service via a multipart upload interface
*/
interface TransferInterface extends HasDispatcherInterface
{
/**
* Upload the source to using a multipart upload
*
* @return Model|null Result of the complete multipart upload command or null if uploading was stopped
*/
public function upload();
/**
* Abort the upload
*
* @return Model Returns the result of the abort multipart upload command
*/
public function abort();
/**
* Get the current state of the upload
*
* @return TransferStateInterface
*/
public function getState();
/**
* Stop the transfer and retrieve the current state.
*
* This allows you to stop and later resume a long running transfer if needed.
*
* @return TransferStateInterface
*/
public function stop();
/**
* Set an option on the transfer object
*
* @param string $option Option to set
* @param mixed $value The value to set
*
* @return self
*/
public function setOption($option, $value);
}
PK �N]
��u5 5 AbstractTransferState.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
use Aws\Common\Exception\RuntimeException;
/**
* State of a multipart upload
*/
abstract class AbstractTransferState implements TransferStateInterface
{
/**
* @var UploadIdInterface Object holding params used to identity the upload part
*/
protected $uploadId;
/**
* @var array Array of parts where the part number is the index
*/
protected $parts = array();
/**
* @var bool Whether or not the transfer was aborted
*/
protected $aborted = false;
/**
* Construct a new transfer state object
*
* @param UploadIdInterface $uploadId Upload identifier object
*/
public function __construct(UploadIdInterface $uploadId)
{
$this->uploadId = $uploadId;
}
/**
* {@inheritdoc}
*/
public function getUploadId()
{
return $this->uploadId;
}
/**
* Get a data value from the transfer state's uploadId
*
* @param string $key Key to retrieve (e.g. Bucket, Key, UploadId, etc)
*
* @return string|null
*/
public function getFromId($key)
{
$params = $this->uploadId->toParams();
return isset($params[$key]) ? $params[$key] : null;
}
/**
* {@inheritdoc}
*/
public function getPart($partNumber)
{
return isset($this->parts[$partNumber]) ? $this->parts[$partNumber] : null;
}
/**
* {@inheritdoc}
*/
public function addPart(UploadPartInterface $part)
{
$partNumber = $part->getPartNumber();
$this->parts[$partNumber] = $part;
return $this;
}
/**
* {@inheritdoc}
*/
public function hasPart($partNumber)
{
return isset($this->parts[$partNumber]);
}
/**
* {@inheritdoc}
*/
public function getPartNumbers()
{
return array_keys($this->parts);
}
/**
* {@inheritdoc}
*/
public function setAborted($aborted)
{
$this->aborted = (bool) $aborted;
return $this;
}
/**
* {@inheritdoc}
*/
public function isAborted()
{
return $this->aborted;
}
/**
* {@inheritdoc}
*/
public function count()
{
return count($this->parts);
}
/**
* {@inheritdoc}
*/
public function getIterator()
{
return new \ArrayIterator($this->parts);
}
/**
* {@inheritdoc}
*/
public function serialize()
{
return serialize(get_object_vars($this));
}
/**
* {@inheritdoc}
*/
public function unserialize($serialized)
{
$data = unserialize($serialized);
foreach (get_object_vars($this) as $property => $oldValue) {
if (array_key_exists($property, $data)) {
$this->{$property} = $data[$property];
} else {
throw new RuntimeException("The {$property} property could be restored during unserialization.");
}
}
}
}
PK �N]�v�i i UploadIdInterface.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\Common\Model\MultipartUpload;
/**
* An object that encapsulates the data identifying an upload
*/
interface UploadIdInterface extends \Serializable
{
/**
* Create an UploadId from an array
*
* @param array $data Data representing the upload identification
*
* @return self
*/
public static function fromParams($data);
/**
* Returns the array form of the upload identification for use as command params
*
* @return array
*/
public function toParams();
}
PK �]��l� � UploadPart.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model\MultipartUpload;
use Aws\Common\Model\MultipartUpload\AbstractUploadPart;
/**
* An object that encapsulates the data for a Glacier upload operation
*/
class UploadPart extends AbstractUploadPart
{
/**
* {@inheritdoc}
*/
protected static $keyMap = array(
'PartNumber' => 'partNumber',
'ETag' => 'eTag',
'LastModified' => 'lastModified',
'Size' => 'size'
);
/**
* @var string The ETag for this part
*/
protected $eTag;
/**
* @var string The last modified date
*/
protected $lastModified;
/**
* @var int The size (or content-length) in bytes of the upload body
*/
protected $size;
/**
* @return string
*/
public function getETag()
{
return $this->eTag;
}
/**
* @return string
*/
public function getLastModified()
{
return $this->lastModified;
}
/**
* @return int
*/
public function getSize()
{
return $this->size;
}
}
PK �]㋄�� � TransferState.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model\MultipartUpload;
use Aws\Common\Client\AwsClientInterface;
use Aws\Common\Model\MultipartUpload\AbstractTransferState;
use Aws\Common\Model\MultipartUpload\UploadIdInterface;
/**
* State of a multipart upload
*/
class TransferState extends AbstractTransferState
{
/**
* {@inheritdoc}
*/
public static function fromUploadId(AwsClientInterface $client, UploadIdInterface $uploadId)
{
$transferState = new self($uploadId);
foreach ($client->getIterator('ListParts', $uploadId->toParams()) as $part) {
$transferState->addPart(UploadPart::fromArray($part));
}
return $transferState;
}
}
PK �]z�� ParallelTransfer.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model\MultipartUpload;
use Aws\Common\Exception\RuntimeException;
use Aws\Common\Enum\DateFormat;
use Aws\Common\Enum\UaString as Ua;
use Guzzle\Http\EntityBody;
use Guzzle\Http\ReadLimitEntityBody;
/**
* Transfers multipart upload parts in parallel
*/
class ParallelTransfer extends AbstractTransfer
{
/**
* {@inheritdoc}
*/
protected function init()
{
parent::init();
if (!$this->source->isLocal() || $this->source->getWrapper() != 'plainfile') {
throw new RuntimeException('The source data must be a local file stream when uploading in parallel.');
}
if (empty($this->options['concurrency'])) {
throw new RuntimeException('The `concurrency` option must be specified when instantiating.');
}
}
/**
* {@inheritdoc}
*/
protected function transfer()
{
$totalParts = (int) ceil($this->source->getContentLength() / $this->partSize);
$concurrency = min($totalParts, $this->options['concurrency']);
$partsToSend = $this->prepareParts($concurrency);
$eventData = $this->getEventData();
while (!$this->stopped && count($this->state) < $totalParts) {
$currentTotal = count($this->state);
$commands = array();
for ($i = 0; $i < $concurrency && $i + $currentTotal < $totalParts; $i++) {
// Move the offset to the correct position
$partsToSend[$i]->setOffset(($currentTotal + $i) * $this->partSize);
// @codeCoverageIgnoreStart
if ($partsToSend[$i]->getContentLength() == 0) {
break;
}
// @codeCoverageIgnoreEnd
$params = $this->state->getUploadId()->toParams();
$eventData['command'] = $this->client->getCommand('UploadPart', array_replace($params, array(
'PartNumber' => count($this->state) + 1 + $i,
'Body' => $partsToSend[$i],
'ContentMD5' => (bool) $this->options['part_md5'],
Ua::OPTION => Ua::MULTIPART_UPLOAD
)));
$commands[] = $eventData['command'];
// Notify any listeners of the part upload
$this->dispatch(self::BEFORE_PART_UPLOAD, $eventData);
}
// Allow listeners to stop the transfer if needed
if ($this->stopped) {
break;
}
// Execute each command, iterate over the results, and add to the transfer state
/** @var \Guzzle\Service\Command\OperationCommand $command */
foreach ($this->client->execute($commands) as $command) {
$this->state->addPart(UploadPart::fromArray(array(
'PartNumber' => $command['PartNumber'],
'ETag' => $command->getResponse()->getEtag(),
'Size' => (int) $command->getRequest()->getBody()->getContentLength(),
'LastModified' => gmdate(DateFormat::RFC2822)
)));
$eventData['command'] = $command;
// Notify any listeners the the part was uploaded
$this->dispatch(self::AFTER_PART_UPLOAD, $eventData);
}
}
}
/**
* Prepare the entity body handles to use while transferring
*
* @param int $concurrency Number of parts to prepare
*
* @return array Parts to send
*/
protected function prepareParts($concurrency)
{
$url = $this->source->getUri();
// Use the source EntityBody as the first part
$parts = array(new ReadLimitEntityBody($this->source, $this->partSize));
// Open EntityBody handles for each part to upload in parallel
for ($i = 1; $i < $concurrency; $i++) {
$parts[] = new ReadLimitEntityBody(new EntityBody(fopen($url, 'r')), $this->partSize);
}
return $parts;
}
}
PK �]���t t SerialTransfer.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model\MultipartUpload;
use Aws\Common\Enum\DateFormat;
use Aws\Common\Enum\Size;
use Aws\Common\Enum\UaString as Ua;
use Guzzle\Http\EntityBody;
use Guzzle\Http\ReadLimitEntityBody;
/**
* Transfers multipart upload parts serially
*/
class SerialTransfer extends AbstractTransfer
{
/**
* {@inheritdoc}
*/
protected function transfer()
{
while (!$this->stopped && !$this->source->isConsumed()) {
if ($this->source->getContentLength() && $this->source->isSeekable()) {
// If the stream is seekable and the Content-Length known, then stream from the data source
$body = new ReadLimitEntityBody($this->source, $this->partSize, $this->source->ftell());
} else {
// We need to read the data source into a temporary buffer before streaming
$body = EntityBody::factory();
while ($body->getContentLength() < $this->partSize
&& $body->write(
$this->source->read(max(1, min(10 * Size::KB, $this->partSize - $body->getContentLength())))
));
}
// @codeCoverageIgnoreStart
if ($body->getContentLength() == 0) {
break;
}
// @codeCoverageIgnoreEnd
$params = $this->state->getUploadId()->toParams();
$command = $this->client->getCommand('UploadPart', array_replace($params, array(
'PartNumber' => count($this->state) + 1,
'Body' => $body,
'ContentMD5' => (bool) $this->options['part_md5'],
Ua::OPTION => Ua::MULTIPART_UPLOAD
)));
// Notify observers that the part is about to be uploaded
$eventData = $this->getEventData();
$eventData['command'] = $command;
$this->dispatch(self::BEFORE_PART_UPLOAD, $eventData);
// Allow listeners to stop the transfer if needed
if ($this->stopped) {
break;
}
$response = $command->getResponse();
$this->state->addPart(UploadPart::fromArray(array(
'PartNumber' => $command['PartNumber'],
'ETag' => $response->getEtag(),
'Size' => $body->getContentLength(),
'LastModified' => gmdate(DateFormat::RFC2822)
)));
// Notify observers that the part was uploaded
$this->dispatch(self::AFTER_PART_UPLOAD, $eventData);
}
}
}
PK �]rs{��! �! UploadBuilder.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model\MultipartUpload;
use Aws\Common\Enum\UaString as Ua;
use Aws\Common\Exception\InvalidArgumentException;
use Aws\Common\Model\MultipartUpload\AbstractUploadBuilder;
use Aws\S3\Model\Acp;
/**
* Easily create a multipart uploader used to quickly and reliably upload a
* large file or data stream to Amazon S3 using multipart uploads
*/
class UploadBuilder extends AbstractUploadBuilder
{
/**
* @var int Concurrency level to transfer the parts
*/
protected $concurrency = 1;
/**
* @var int Minimum part size to upload
*/
protected $minPartSize = AbstractTransfer::MIN_PART_SIZE;
/**
* @var string MD5 hash of the entire body to transfer
*/
protected $md5;
/**
* @var bool Whether or not to calculate the entire MD5 hash of the object
*/
protected $calculateEntireMd5 = false;
/**
* @var bool Whether or not to calculate MD5 hash of each part
*/
protected $calculatePartMd5 = true;
/**
* @var array Array of initiate command options
*/
protected $commandOptions = array();
/**
* @var array Array of transfer options
*/
protected $transferOptions = array();
/**
* Set the bucket to upload the object to
*
* @param string $bucket Name of the bucket
*
* @return $this
*/
public function setBucket($bucket)
{
return $this->setOption('Bucket', $bucket);
}
/**
* Set the key of the object
*
* @param string $key Key of the object to upload
*
* @return $this
*/
public function setKey($key)
{
return $this->setOption('Key', $key);
}
/**
* Set the minimum acceptable part size
*
* @param int $minSize Minimum acceptable part size in bytes
*
* @return $this
*/
public function setMinPartSize($minSize)
{
$this->minPartSize = (int) max((int) $minSize, AbstractTransfer::MIN_PART_SIZE);
return $this;
}
/**
* Set the concurrency level to use when uploading parts. This affects how
* many parts are uploaded in parallel. You must use a local file as your
* data source when using a concurrency greater than 1
*
* @param int $concurrency Concurrency level
*
* @return $this
*/
public function setConcurrency($concurrency)
{
$this->concurrency = $concurrency;
return $this;
}
/**
* Explicitly set the MD5 hash of the entire body
*
* @param string $md5 MD5 hash of the entire body
*
* @return $this
*/
public function setMd5($md5)
{
$this->md5 = $md5;
return $this;
}
/**
* Set to true to have the builder calculate the MD5 hash of the entire data
* source before initiating a multipart upload (this could be an expensive
* operation). This setting can ony be used with seekable data sources.
*
* @param bool $calculateMd5 Set to true to calculate the MD5 hash of the body
*
* @return $this
*/
public function calculateMd5($calculateMd5)
{
$this->calculateEntireMd5 = (bool) $calculateMd5;
return $this;
}
/**
* Specify whether or not to calculate the MD5 hash of each uploaded part.
* This setting defaults to true.
*
* @param bool $usePartMd5 Set to true to calculate the MD5 has of each part
*
* @return $this
*/
public function calculatePartMd5($usePartMd5)
{
$this->calculatePartMd5 = (bool) $usePartMd5;
return $this;
}
/**
* Set the ACP to use on the object
*
* @param Acp $acp ACP to set on the object
*
* @return $this
*/
public function setAcp(Acp $acp)
{
return $this->setOption('ACP', $acp);
}
/**
* Set an option to pass to the initial CreateMultipartUpload operation
*
* @param string $name Option name
* @param string $value Option value
*
* @return $this
*/
public function setOption($name, $value)
{
$this->commandOptions[$name] = $value;
return $this;
}
/**
* Add an array of options to pass to the initial CreateMultipartUpload operation
*
* @param array $options Array of CreateMultipartUpload operation parameters
*
* @return $this
*/
public function addOptions(array $options)
{
$this->commandOptions = array_replace($this->commandOptions, $options);
return $this;
}
/**
* Set an array of transfer options to apply to the upload transfer object
*
* @param array $options Transfer options
*
* @return $this
*/
public function setTransferOptions(array $options)
{
$this->transferOptions = $options;
return $this;
}
/**
* {@inheritdoc}
* @throws InvalidArgumentException when attempting to resume a transfer using a non-seekable stream
* @throws InvalidArgumentException when missing required properties (bucket, key, client, source)
*/
public function build()
{
if ($this->state instanceof TransferState) {
$this->commandOptions = array_replace($this->commandOptions, $this->state->getUploadId()->toParams());
}
if (!isset($this->commandOptions['Bucket']) || !isset($this->commandOptions['Key'])
|| !$this->client || !$this->source
) {
throw new InvalidArgumentException('You must specify a Bucket, Key, client, and source.');
}
if ($this->state && !$this->source->isSeekable()) {
throw new InvalidArgumentException('You cannot resume a transfer using a non-seekable source.');
}
// If no state was set, then create one by initiating or loading a multipart upload
if (is_string($this->state)) {
$this->state = TransferState::fromUploadId($this->client, UploadId::fromParams(array(
'Bucket' => $this->commandOptions['Bucket'],
'Key' => $this->commandOptions['Key'],
'UploadId' => $this->state
)));
} elseif (!$this->state) {
$this->state = $this->initiateMultipartUpload();
}
$options = array_replace(array(
'min_part_size' => $this->minPartSize,
'part_md5' => (bool) $this->calculatePartMd5,
'concurrency' => $this->concurrency
), $this->transferOptions);
return $this->concurrency > 1
? new ParallelTransfer($this->client, $this->state, $this->source, $options)
: new SerialTransfer($this->client, $this->state, $this->source, $options);
}
/**
* {@inheritdoc}
*/
protected function initiateMultipartUpload()
{
// Determine Content-Type
if (!isset($this->commandOptions['ContentType'])) {
if ($mimeType = $this->source->getContentType()) {
$this->commandOptions['ContentType'] = $mimeType;
}
}
$params = array_replace(array(
Ua::OPTION => Ua::MULTIPART_UPLOAD,
'command.headers' => $this->headers,
'Metadata' => array()
), $this->commandOptions);
// Calculate the MD5 hash if none was set and it is asked of the builder
if ($this->calculateEntireMd5) {
$this->md5 = $this->source->getContentMd5();
}
// If an MD5 is specified, then add it to the custom headers of the request
// so that it will be returned when downloading the object from Amazon S3
if ($this->md5) {
$params['Metadata']['x-amz-Content-MD5'] = $this->md5;
}
$result = $this->client->getCommand('CreateMultipartUpload', $params)->execute();
// Create a new state based on the initiated upload
$params['UploadId'] = $result['UploadId'];
return new TransferState(UploadId::fromParams($params));
}
}
PK �]��� � UploadId.phpnu &1i� <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model\MultipartUpload;
use Aws\Common\Model\MultipartUpload\AbstractUploadId;
/**
* An object that encapsulates the identification for a Glacier upload part
* @codeCoverageIgnore
*/
class UploadId extends AbstractUploadId
{
/**
* {@inheritdoc}
*/
protected static $expectedValues = array(
'Bucket' => false,
'Key' => false,
'UploadId' => false
);
}
PK �N].S �� � AbstractUploadBuilder.phpnu &1i� PK �N]g� $� � AbstractUploadPart.phpnu &1i� PK �N]
��
E AbstractTransfer.phpnu &1i� PK �N]sգ� � �( UploadPartInterface.phpnu &1i� PK �N]���;� � �- TransferStateInterface.phpnu &1i� PK �N]�@�� �7 .htaccessnu ��6�$ PK �N]n$�� � �8 AbstractUploadId.phpnu &1i� PK �N]�\��O O B TransferInterface.phpnu &1i� PK �N]
��u5 5 �I AbstractTransferState.phpnu &1i� PK �N]�v�i i 'X UploadIdInterface.phpnu &1i� PK �]��l� � �\ UploadPart.phpnu &1i� PK �]㋄�� � �c TransferState.phpnu &1i� PK �]z�� �h ParallelTransfer.phpnu &1i� PK �]���t t ,{ SerialTransfer.phpnu &1i� PK �]rs{��! �! � UploadBuilder.phpnu &1i� PK �]��� � � UploadId.phpnu &1i� PK 6 (�