Classes/Command/S3CommandController.php
/**
     * Republish a collection
     *
     * This command forces publishing resources of the given collection by copying resources from the respective storage
     * to target bucket.
     *
     * @param string $collection Name of the collection to publish
     */
Republish a collection
This command forces publishing resources of the given collection by copying resources from the respective storage
to target bucket.

@param string $collection Name of the collection to publish
Republish a collection This command forces publishing resources of the given collection by copying resources from the respective storage to target bucket . @param string $collection Name of the collection to publish
public function republishCommand(string $collection = 'persistent'): void
    {
        $collectionName = $collection;
        $collection = $this->resourceManager->getCollection($collectionName);
        if (!$collection) {
            $this->outputLine('<error>The collection %s does not exist.</error>', [$collectionName]);
            exit(1);
        }
        $target = $collection->getTarget();
        if (!$target instanceof S3Target) {
            $this->outputLine('<error>The target defined in collection %s is not an S3 target.</error>', [$collectionName]);
            exit(1);
        }
        $this->outputLine('Republishing collection ...');
        $this->output->progressStart();
        try {
            foreach ($collection->getObjects() as $object) {
                $resource = $this->resourceManager->getResourceBySha1($object->getSha1());
                if ($resource) {
                    $target->publishResource($resource, $collection);
                }
                $this->output->progressAdvance();
            }
        } catch (\Exception $e) {
            $this->outputLine('<error>Publishing failed</error>');
            $this->outputLine($e->getMessage());
            $this->outputLine(get_class($e));
            exit(2);
        }
        $this->output->progressFinish();
        $this->outputLine();
    }
public function republishCommand ( string $ collection = 'persistent' ) : void { $ collectionName = $ collection ; $ collection = $ this -> resourceManager -> getCollection ( $ collectionName ) ; if ( ! $ collection ) { $ this -> outputLine ( '<error>The collection %s does not exist.</error>' , [ $ collectionName ] ) ; exit ( 1 ) ; } $ target = $ collection -> getTarget ( ) ; if ( ! $ target instanceof S3Target ) { $ this -> outputLine ( '<error>The target defined in collection %s is not an S3 target.</error>' , [ $ collectionName ] ) ; exit ( 1 ) ; } $ this -> outputLine ( 'Republishing collection ...' ) ; $ this -> output -> progressStart ( ) ; try { foreach ( $ collection -> getObjects ( ) as $ object ) { $ resource = $ this -> resourceManager -> getResourceBySha1 ( $ object -> getSha1 ( ) ) ; if ( $ resource ) { $ target -> publishResource ( $ resource , $ collection ) ; } $ this -> output -> progressAdvance ( ) ; } } catch ( \ Exception $ e ) { $ this -> outputLine ( '<error>Publishing failed</error>' ) ; $ this -> outputLine ( $ e -> getMessage ( ) ) ; $ this -> outputLine ( get_class ( $ e ) ) ; exit ( 2 ) ; } $ this -> output -> progressFinish ( ) ; $ this -> outputLine ( ) ; }
Republish a collection
 This command forces publishing resources of the given collection by copying resources from the respective storage
 to target bucket.
Republish a collection This command forces publishing resources of the given collection by copying resources from the respective storage to target bucket .
/** @var StorageObject $object */