PHP Class Neos\Flow\ResourceManagement\Target\FileSystemTarget

Inheritance: implements Neos\Flow\ResourceManagement\Target\TargetInterface
Show file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$absoluteBaseUri string The resolved absolute web URI for this target. If $baseUri was absolute this will be the same, otherwise the request base uri will be prepended.
$baseUri string Can be relative to website's base Uri, for example "_Resources/MySpecialTarget/". If resources should be served from a different domain, make sure to specify an absolute URI though
$bootstrap Neos\Flow\Core\Bootstrap
$extensionBlacklist array A list of extensions that are blacklisted and must not be published by this target.
$httpBaseUri string The configured Neos.Flow.http.baseUri to use as fallback if no absolute baseUri is configured and if it can't be determined from the current request (e.g. in CLI mode)
$messageCollector Neos\Flow\ResourceManagement\Publishing\MessageCollector
$name string Name which identifies this publishing target
$options array
$path string The path (in a filesystem) where resources are published to
$resourceRepository Neos\Flow\ResourceManagement\ResourceRepository
$subdivideHashPathSegment boolean If the generated URI path segment containing the sha1 should be divided into multiple segments
$systemLogger Neos\Flow\Log\SystemLoggerInterface

Public Methods

Method Description
__construct ( string $name, array $options = [] ) Constructor
getName ( ) : string Returns the name of this target instance
getPublicPersistentResourceUri ( PersistentResource $resource ) : string Returns the web accessible URI pointing to the specified persistent resource
getPublicStaticResourceUri ( string $relativePathAndFilename ) : string Returns the web accessible URI pointing to the given static resource
initializeObject ( ) : void Initializes this resource publishing target
publishCollection ( Neos\Flow\ResourceManagement\CollectionInterface $collection, callable $callback = null ) : void Publishes the whole collection to this target
publishResource ( PersistentResource $resource, Neos\Flow\ResourceManagement\CollectionInterface $collection ) : void Publishes the given persistent resource from the given storage
unpublishResource ( PersistentResource $resource ) : void Unpublishes the given persistent resource

Protected Methods

Method Description
detectResourcesBaseUri ( ) : string Detects and returns the website's absolute base URI
encodeRelativePathAndFilenameForUri ( string $relativePathAndFilename ) : string Applies rawurlencode() to all path segments of the given $relativePathAndFilename
getRelativePublicationPathAndFilename ( Neos\Flow\ResourceManagement\ResourceMetaDataInterface $object ) : string Determines and returns the relative path and filename for the given Storage Object or PersistentResource. If the given object represents a persistent resource, its own relative publication path will be empty. If the given object represents a static resources, it will contain a relative path.
getResourcesBaseUri ( ) : string Returns the resolved absolute base URI for resources of this target.
handleMissingData ( Neos\Flow\ResourceManagement\ResourceMetaDataInterface $resource, Neos\Flow\ResourceManagement\CollectionInterface $collection ) Handle missing data notification
publishFile ( resource $sourceStream, string $relativeTargetPathAndFilename ) : void Publishes the given source stream to this target, with the given relative path.
setOption ( string $key, mixed $value ) : boolean Set an option value and return if it was set.
unpublishFile ( string $relativeTargetPathAndFilename ) : void Removes the specified target file from the public directory

Method Details

__construct() public method

Constructor
public __construct ( string $name, array $options = [] )
$name string Name of this target instance, according to the resource settings
$options array Options for this target

detectResourcesBaseUri() protected method

Detects and returns the website's absolute base URI
protected detectResourcesBaseUri ( ) : string
return string The resolved resource base URI, @see getResourcesBaseUri()

encodeRelativePathAndFilenameForUri() protected method

Applies rawurlencode() to all path segments of the given $relativePathAndFilename
protected encodeRelativePathAndFilenameForUri ( string $relativePathAndFilename ) : string
$relativePathAndFilename string
return string

getName() public method

Returns the name of this target instance
public getName ( ) : string
return string

getPublicPersistentResourceUri() public method

Returns the web accessible URI pointing to the specified persistent resource
public getPublicPersistentResourceUri ( PersistentResource $resource ) : string
$resource Neos\Flow\ResourceManagement\PersistentResource PersistentResource object
return string The URI

getPublicStaticResourceUri() public method

Returns the web accessible URI pointing to the given static resource
public getPublicStaticResourceUri ( string $relativePathAndFilename ) : string
$relativePathAndFilename string Relative path and filename of the static resource
return string The URI

getRelativePublicationPathAndFilename() protected method

No matter which kind of resource, persistent or static, this function will return a sub directory structure if no relative publication path was defined in the given object.
protected getRelativePublicationPathAndFilename ( Neos\Flow\ResourceManagement\ResourceMetaDataInterface $object ) : string
$object Neos\Flow\ResourceManagement\ResourceMetaDataInterface PersistentResource or Storage Object
return string The relative path and filename, for example "c/8/2/8/c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if subdivideHashPathSegment is on) or "c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if it's off)

getResourcesBaseUri() protected method

Returns the resolved absolute base URI for resources of this target.
protected getResourcesBaseUri ( ) : string
return string The absolute base URI for resources in this target

handleMissingData() protected method

Handle missing data notification
protected handleMissingData ( Neos\Flow\ResourceManagement\ResourceMetaDataInterface $resource, Neos\Flow\ResourceManagement\CollectionInterface $collection )
$resource Neos\Flow\ResourceManagement\ResourceMetaDataInterface
$collection Neos\Flow\ResourceManagement\CollectionInterface

initializeObject() public method

Initializes this resource publishing target
public initializeObject ( ) : void
return void

publishCollection() public method

Publishes the whole collection to this target
public publishCollection ( Neos\Flow\ResourceManagement\CollectionInterface $collection, callable $callback = null ) : void
$collection Neos\Flow\ResourceManagement\CollectionInterface The collection to publish
$callback callable Function called after each resource publishing
return void

publishFile() protected method

Publishes the given source stream to this target, with the given relative path.
protected publishFile ( resource $sourceStream, string $relativeTargetPathAndFilename ) : void
$sourceStream resource Stream of the source to publish
$relativeTargetPathAndFilename string relative path and filename in the target directory
return void

publishResource() public method

Publishes the given persistent resource from the given storage
public publishResource ( PersistentResource $resource, Neos\Flow\ResourceManagement\CollectionInterface $collection ) : void
$resource Neos\Flow\ResourceManagement\PersistentResource The resource to publish
$collection Neos\Flow\ResourceManagement\CollectionInterface The collection the given resource belongs to
return void

setOption() protected method

Set an option value and return if it was set.
protected setOption ( string $key, mixed $value ) : boolean
$key string
$value mixed
return boolean

unpublishFile() protected method

This method fails silently if the given file could not be unpublished or already didn't exist anymore.
protected unpublishFile ( string $relativeTargetPathAndFilename ) : void
$relativeTargetPathAndFilename string relative path and filename in the target directory
return void

unpublishResource() public method

Unpublishes the given persistent resource
public unpublishResource ( PersistentResource $resource ) : void
$resource Neos\Flow\ResourceManagement\PersistentResource The resource to unpublish
return void

Property Details

$absoluteBaseUri protected property

The resolved absolute web URI for this target. If $baseUri was absolute this will be the same, otherwise the request base uri will be prepended.
protected string $absoluteBaseUri
return string

$baseUri protected property

Can be relative to website's base Uri, for example "_Resources/MySpecialTarget/". If resources should be served from a different domain, make sure to specify an absolute URI though
protected string $baseUri
return string

$bootstrap protected property

protected Bootstrap,Neos\Flow\Core $bootstrap
return Neos\Flow\Core\Bootstrap

$extensionBlacklist protected property

A list of extensions that are blacklisted and must not be published by this target.
protected array $extensionBlacklist
return array

$httpBaseUri protected property

The configured Neos.Flow.http.baseUri to use as fallback if no absolute baseUri is configured and if it can't be determined from the current request (e.g. in CLI mode)
protected string $httpBaseUri
return string

$messageCollector protected property

protected MessageCollector,Neos\Flow\ResourceManagement\Publishing $messageCollector
return Neos\Flow\ResourceManagement\Publishing\MessageCollector

$name protected property

Name which identifies this publishing target
protected string $name
return string

$options protected property

protected array $options
return array

$path protected property

The path (in a filesystem) where resources are published to
protected string $path
return string

$resourceRepository protected property

protected ResourceRepository,Neos\Flow\ResourceManagement $resourceRepository
return Neos\Flow\ResourceManagement\ResourceRepository

$subdivideHashPathSegment protected property

If the generated URI path segment containing the sha1 should be divided into multiple segments
protected bool $subdivideHashPathSegment
return boolean

$systemLogger protected property

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
return Neos\Flow\Log\SystemLoggerInterface