class MediaCommandController extends CommandController (View source)

Properties

protected PersistenceManagerInterface $persistenceManager
protected EntityManagerInterface $entityManager
protected Connection $dbalConnection
protected AssetRepository $assetRepository
protected ThumbnailRepository $thumbnailRepository
protected ImageVariantRepository $imageVariantRepository
protected AssetService $assetService
protected ThumbnailService $thumbnailService
protected bool $asyncThumbnails
protected AssetModelMappingStrategyInterface $mappingStrategy
protected ReflectionService $reflectionService
protected AssetVariantGenerator $assetVariantGenerator

Methods

void
importResourcesCommand(bool $simulate = false, bool $quiet = false)

Import resources to asset management

void
removeUnusedCommand(string $assetSource = '', bool $quiet = false, bool $assumeYes = false, string $onlyTags = '', int $limit = null, string $onlyCollections = '')

Remove unused assets

void
createThumbnailsCommand(string $preset = null, bool $async = null, bool $quiet = false)

Create thumbnails

void
clearThumbnailsCommand(string $preset = null, bool $quiet = false)

Remove thumbnails

void
renderThumbnailsCommand(int $limit = null, bool $quiet = false)

Render ungenerated thumbnails

void
listVariantPresetsCommand()

List all configurations for your imageVariants.

removeVariantsCommand(string $identifier, string $variantName, bool $quiet = false, bool $assumeYes = false, int $limit = null)

Cleanup imageVariants with provided identifier and variant name.

void
renderVariantsCommand(int $limit = null, bool $quiet = false, bool $recreate = false)

Render asset variants

void
persistAll(int $iteration)

Used as a callback when iterating large results sets

void
initializeConnection()

Initializes the DBAL connection which is currently bound to the Doctrine Entity Manager

Details

void importResourcesCommand(bool $simulate = false, bool $quiet = false)

Import resources to asset management

This command detects Flow "PersistentResource"s which are not yet available as "Asset" objects and thus don't appear in the asset management. The type of the imported asset is determined by the file extension provided by the PersistentResource.

Parameters

bool $simulate

If set, this command will only tell what it would do instead of doing it right away

bool $quiet

Return Value

void

Exceptions

IllegalObjectTypeException
DBALException

void removeUnusedCommand(string $assetSource = '', bool $quiet = false, bool $assumeYes = false, string $onlyTags = '', int $limit = null, string $onlyCollections = '')

Remove unused assets

This command iterates over all existing assets, checks their usage count and lists the assets which are not reported as used by any AssetUsageStrategies. The unused assets can than be removed.

Parameters

string $assetSource

If specified, only assets of this asset source are considered. For example "neos" or "my-asset-management-system"

bool $quiet

If set, only errors will be displayed.

bool $assumeYes

If set, "yes" is assumed for the "shall I remove ..." dialogs

string $onlyTags

Comma-separated list of asset tag labels, that should be taken into account

int $limit

Limit the result of unused assets displayed and removed for this run.

string $onlyCollections

Comma-separated list of asset collection titles, that should be taken into account

Return Value

void

Exceptions

IllegalObjectTypeException
AssetServiceException

void createThumbnailsCommand(string $preset = null, bool $async = null, bool $quiet = false)

Create thumbnails

Creates thumbnail images based on the configured thumbnail presets. Optional preset parameter to only create thumbnails for a specific thumbnail preset configuration.

Additionally, accepts a async parameter determining if the created thumbnails are generated when created.

Parameters

string $preset

Preset name, if not provided thumbnails are created for all presets

bool $async

Asynchronous generation, if not provided the setting Neos.Media.asyncThumbnails is used

bool $quiet

If set, only errors will be displayed.

Return Value

void

Exceptions

ThumbnailServiceException

void clearThumbnailsCommand(string $preset = null, bool $quiet = false)

Remove thumbnails

Removes all thumbnail objects and their resources. Optional preset parameter to only remove thumbnails matching a specific thumbnail preset configuration.

Parameters

string $preset

Preset name, if provided only thumbnails matching that preset are cleared

bool $quiet

If set, only errors will be displayed.

Return Value

void

Exceptions

IllegalObjectTypeException
ThumbnailServiceException

void renderThumbnailsCommand(int $limit = null, bool $quiet = false)

Render ungenerated thumbnails

Loops over ungenerated thumbnails and renders them. Optional limit parameter to limit the amount of thumbnails to be rendered to avoid memory exhaustion.

Parameters

int $limit

Limit the amount of thumbnails to be rendered to avoid memory exhaustion

bool $quiet

If set, only errors will be displayed.

Return Value

void

void listVariantPresetsCommand()

List all configurations for your imageVariants.

Doesn't matter if configured under 'Neos.Media.variantPresets' or already deleted from this configuration. This command will find every single one for you.

Return Value

void

removeVariantsCommand(string $identifier, string $variantName, bool $quiet = false, bool $assumeYes = false, int $limit = null)

Cleanup imageVariants with provided identifier and variant name.

Image variants that are still configured are removed without usage check and can be regenerated afterwards with media:renderVariants.

This command will not remove any custom cropped image variants.

Parameters

string $identifier

Identifier of variants to remove.

string $variantName

Variants with this name will be removed (if exist).

bool $quiet

If set, only errors and questions will be displayed.

bool $assumeYes

If set, "yes" is assumed for the "shall I remove ..." dialog.

int $limit

Limit the result of unused assets displayed and removed for this run.

Exceptions

StopCommandException

void renderVariantsCommand(int $limit = null, bool $quiet = false, bool $recreate = false)

Render asset variants

Loops over missing configured asset variants and renders them. Optional limit parameter to limit the amount of variants to be rendered to avoid memory exhaustion.

If the re-render parameter is given, any existing variants will be rendered again, too.

Parameters

int $limit

Limit the amount of variants to be rendered to avoid memory exhaustion

bool $quiet

If set, only errors will be displayed.

bool $recreate

If set, existing asset variants will be re-generated and replaced

Return Value

void

Exceptions

AssetVariantGeneratorException
IllegalObjectTypeException

protected void persistAll(int $iteration)

Used as a callback when iterating large results sets

Parameters

int $iteration

Return Value

void

protected void initializeConnection()

Initializes the DBAL connection which is currently bound to the Doctrine Entity Manager

Return Value

void