send_multi_request() public méthode

Sends the request using , enabling parallel requests. Uses the "rolling" method.
public send_multi_request ( array $handles, array $opt = null ) : array
$handles array (Required) An indexed array of cURL handles to process simultaneously.
$opt array (Optional) An associative array of parameters that can have the following keys:
  • callback - string|array - Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the [0] index is the class and the [1] index is the method name.
  • limit - integer - Optional - The number of simultaneous requests to make. This can be useful for scaling around slow server responses. Defaults to trusting cURLs judgement as to how many to use.
Résultat array Post-processed cURL responses.
 /**
  * Method: copy_object()
  * 	Copies an Amazon S3 object to a new location, whether in the same Amazon S3 region, bucket, or
  * 	otherwise.
  *
  * Access:
  * 	public
  *
  * Parameters:
  * 	$source - _array_ (Required) An associative array containing two keys: `bucket`, specifying the name of the bucket containing the source object, and `filename`, specifying the file name of the source object to copy.
  * 	$dest - _array_ (Required) An associative array containing two keys: `bucket`, specifying the name of the bucket to store the destination object in, and `filename`, specifying the file name of the destination object name.
  * 	$opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
  *
  * Keys for the $opt parameter:
  * 	acl - _string_ (Optional) The ACL settings for the specified object. [Allowed values: `AmazonS3::ACL_PRIVATE`, `AmazonS3::ACL_PUBLIC`, `AmazonS3::ACL_OPEN`, `AmazonS3::ACL_AUTH_READ`, `AmazonS3::ACL_OWNER_READ`, `AmazonS3::ACL_OWNER_FULL_CONTROL`]. Alternatively, an array of associative arrays. Each associative array contains an `id` and a `permission` key. The default value is <ACL_PRIVATE>.
  * 	storage - _string_ (Optional) Whether to use Standard or Reduced Redundancy storage. [Allowed values: `AmazonS3::STORAGE_STANDARD`, `AmazonS3::STORAGE_REDUCED`]. The default value is <STORAGE_STANDARD>.
  * 	versionId - _string_ (Optional) The version of the object to copy. Version IDs are returned in the `x-amz-version-id` header of any previous object-related request.
  * 	ifMatch - _string_ (Optional) The ETag header from a previous request. Copies the object if its entity tag (ETag) matches the specified tag; otherwise, the request returns a `412` HTTP status code error (precondition failed). Used in conjunction with `ifUnmodifiedSince`.
  * 	ifUnmodifiedSince - _string_ (Optional) The LastModified header from a previous request. Copies the object if it hasn't been modified since the specified time; otherwise, the request returns a `412` HTTP status code error (precondition failed). Used in conjunction with `ifMatch`.
  * 	ifNoneMatch - _string_ (Optional) The ETag header from a previous request. Copies the object if its entity tag (ETag) is different than the specified ETag; otherwise, the request returns a `412` HTTP status code error (failed condition). Used in conjunction with `ifModifiedSince`.
  * 	ifModifiedSince - _string_ (Optional) The LastModified header from a previous request. Copies the object if it has been modified since the specified time; otherwise, the request returns a `412` HTTP status code error (failed condition). Used in conjunction with `ifNoneMatch`.
  * 	headers - _array_ (Optional) Standard HTTP headers to send along in the request.
  * 	meta - _array_ (Optional) Associative array of key-value pairs. Represented by `x-amz-meta-:` Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.
  * 	metadataDirective - _string_ (Optional) Accepts either COPY or REPLACE. You will likely never need to use this, as it manages itself with no issues.
  * 	returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
  *
  * Returns:
  * 	_CFResponse_ A <CFResponse> object containing a parsed HTTP response.
  *
  * See Also:
  * 	[Copying Amazon S3 Objects](http://docs.amazonwebservices.com/AmazonS3/latest/UsingCopyingObjects.html)
  */
 public function copy_object($source, $dest, $opt = null)
 {
     if (!$opt) {
         $opt = array();
     }
     $batch = array();
     // Add this to our request
     $opt['verb'] = 'PUT';
     $opt['resource'] = $dest['filename'];
     // Handle copy source
     if (isset($source['bucket']) && isset($source['filename'])) {
         $opt['headers']['x-amz-copy-source'] = '/' . $source['bucket'] . '/' . rawurlencode($source['filename']) . (isset($opt['versionId']) ? '?' . 'versionId=' . rawurlencode($opt['versionId']) : '');
         // Append the versionId to copy, if available
         unset($opt['versionId']);
         // Determine if we need to lookup the pre-existing content-type.
         if (!in_array(strtolower('content-type'), array_map('strtolower', array_keys($opt['headers'])))) {
             $response = $this->get_object_headers($source['bucket'], $source['filename']);
             $opt['headers']['Content-Type'] = $response->header['content-type'];
         }
     }
     // Handle metadata directive
     $opt['headers']['x-amz-metadata-directive'] = 'COPY';
     if ($source['bucket'] === $dest['bucket'] && $source['filename'] === $dest['filename']) {
         $opt['headers']['x-amz-metadata-directive'] = 'REPLACE';
     }
     if (isset($opt['metadataDirective'])) {
         $opt['headers']['x-amz-metadata-directive'] = $opt['metadataDirective'];
         unset($opt['metadataDirective']);
     }
     // Handle Access Control Lists. Can also pass canned ACLs as an HTTP header.
     if (isset($opt['acl']) && is_array($opt['acl'])) {
         $batch[] = $this->set_object_acl($dest['bucket'], $dest['filename'], $opt['acl'], array('returnCurlHandle' => true));
         unset($opt['acl']);
     } elseif (isset($opt['acl'])) {
         $opt['headers']['x-amz-acl'] = $opt['acl'];
         unset($opt['acl']);
     }
     // Handle storage settings. Can also be passed as an HTTP header.
     if (isset($opt['storage'])) {
         $opt['headers']['x-amz-storage-class'] = $opt['storage'];
         unset($opt['storage']);
     }
     // Handle conditional-copy parameters
     if (isset($opt['ifMatch'])) {
         $opt['headers']['x-amz-copy-source-if-match'] = $opt['ifMatch'];
         unset($opt['ifMatch']);
     }
     if (isset($opt['ifNoneMatch'])) {
         $opt['headers']['x-amz-copy-source-if-none-match'] = $opt['ifNoneMatch'];
         unset($opt['ifNoneMatch']);
     }
     if (isset($opt['ifUnmodifiedSince'])) {
         $opt['headers']['x-amz-copy-source-if-unmodified-since'] = $opt['ifUnmodifiedSince'];
         unset($opt['ifUnmodifiedSince']);
     }
     if (isset($opt['ifModifiedSince'])) {
         $opt['headers']['x-amz-copy-source-if-modified-since'] = $opt['ifModifiedSince'];
         unset($opt['ifModifiedSince']);
     }
     // Handle meta tags. Can also be passed as an HTTP header.
     if (isset($opt['meta'])) {
         foreach ($opt['meta'] as $meta_key => $meta_value) {
             // e.g., `My Meta Header` is converted to `x-amz-meta-my-meta-header`.
             $opt['headers']['x-amz-meta-' . strtolower(str_replace(' ', '-', $meta_key))] = $meta_value;
         }
         unset($opt['meta']);
     }
     // Authenticate to S3
     $response = $this->authenticate($dest['bucket'], $opt);
     // Attempt to reset ACLs
     $http = new RequestCore();
     $http->send_multi_request($batch);
     return $response;
 }