Skip to content

Commit

Permalink
Merge pull request #52 from networkteam/master
Browse files Browse the repository at this point in the history
Remove duplicate else
  • Loading branch information
kdambekalns authored Feb 3, 2022
2 parents c3f1625 + b78d6da commit 994c9cb
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions Classes/S3Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,34 +276,6 @@ public function publishCollection(CollectionInterface $collection, callable $cal

if ($storage instanceof S3Storage) {
$this->publishCollectionFromS3Storage($collection, $storage, $potentiallyObsoleteObjects, $callback);
} else {
foreach ($collection->getObjects($callback) as $object) {
/** @var StorageObject $object */
$objectName = $this->keyPrefix . $this->getRelativePublicationPathAndFilename($object);
if (array_key_exists($objectName, $potentiallyObsoleteObjects)) {
$this->systemLogger->debug(sprintf('The resource object "%s" (SHA1: %s) has already been published to bucket "%s", no need to re-publish', $objectName, $object->getSha1() ?: 'unknown', $this->bucketName));
$potentiallyObsoleteObjects[$objectName] = false;
} else {
$options = [
'Bucket' => $this->bucketName,
'CopySource' => urlencode($storageBucketName . '/' . $storage->getKeyPrefix() . $object->getSha1()),
'ContentType' => $object->getMediaType(),
'MetadataDirective' => 'REPLACE',
'Key' => $objectName
];
if ($this->getAcl()) {
$options['ACL'] = $this->getAcl();
}
try {
$this->s3Client->copyObject($options);
$this->systemLogger->debug(sprintf('Successfully copied resource as object "%s" (SHA1: %s) from bucket "%s" to bucket "%s"', $objectName, $object->getSha1() ?: 'unknown', $storageBucketName, $this->bucketName));
} catch (S3Exception $e) {
$message = sprintf('Could not copy resource with SHA1 hash %s of collection %s from bucket %s to %s: %s', $object->getSha1(), $collection->getName(), $storageBucketName, $this->bucketName, $e->getMessage());
$this->systemLogger->critical($e, LogEnvironment::fromMethodName(__METHOD__));
$this->messageCollector->append($message);
}
}
}
} else {
foreach ($collection->getObjects() as $object) {
/** @var StorageObject $object */
Expand Down

0 comments on commit 994c9cb

Please sign in to comment.