/** * listParts * * @param string $key * @param string $uploadId * @param integer $maxParts * @param integer $maxNumberMarker * * @return \Guzzle\Service\Resource\Model */ public function listParts($key, $uploadId, $maxParts = null, $maxNumberMarker = null) { $params = ['Bucket' => $this->name, 'Key' => $key, 'UploadId' => $uploadId]; if (!is_null($maxParts)) { $params['MaxParts'] = $maxParts; } if (!is_null($maxNumberMarker)) { $params['MaxNumberMarker'] = $maxNumberMarker; } return $this->client->listParts($params); }
/** * Calling `$this->s3->listParts($fileoptions);` is okay in general unless there are more than 1000 parts - amazon will only send back the manifest for 1000 parts at a time * With a chuink size of 5mb the file only needs to be >5GB for this to happen. * We call the function recursively to fetch the next set of parts until we have them all. * * @param array $fileoptions * @return array */ private function listParts($fileoptions) { $parts = $this->s3->listParts($fileoptions); $fileoptions['PartNumberMarker'] = $parts['NextPartNumberMarker']; return $parts['IsTruncated'] ? array_merge($parts['Parts'], $this->listParts($fileoptions)) : $parts['Parts']; }