PHP Class Neos\Flow\ResourceManagement\Storage\FileSystemStorage

Inheritance: implements Neos\Flow\ResourceManagement\Storage\StorageInterface
Datei anzeigen Open project: neos/flow-development-collection

Protected Properties

Property Type Description
$environment Neos\Flow\Utility\Environment
$name string Name which identifies this resource storage
$path string The path (in a filesystem) where resources are stored
$resourceManager Neos\Flow\ResourceManagement\ResourceManager
$resourceRepository Neos\Flow\ResourceManagement\ResourceRepository

Public Methods

Method Description
__construct ( string $name, array $options = [] ) Constructor
getName ( ) : string Returns the instance name of this storage
getObjects ( callable $callback = null ) : Generator Retrieve all Objects stored in this storage.
getObjectsByCollection ( Neos\Flow\ResourceManagement\CollectionInterface $collection, callable $callback = null ) : Generator Retrieve all Objects stored in this storage, filtered by the given collection name
getStreamByResource ( PersistentResource $resource ) : resource | boolean Returns a stream handle which can be used internally to open / copy the given resource stored in this storage.
getStreamByResourcePath ( string $relativePath ) : resource | boolean Returns a stream handle which can be used internally to open / copy the given resource stored in this storage.
initializeObject ( ) : void Initializes this resource storage

Protected Methods

Method Description
getStoragePathAndFilenameByHash ( string $sha1Hash ) : string Determines and returns the absolute path and filename for a storage file identified by the given SHA1 hash.

Method Details

__construct() public method

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

getName() public method

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

getObjects() public method

Retrieve all Objects stored in this storage.
public getObjects ( callable $callback = null ) : Generator
$callback callable Function called after each iteration
return Generator

getObjectsByCollection() public method

Retrieve all Objects stored in this storage, filtered by the given collection name
public getObjectsByCollection ( Neos\Flow\ResourceManagement\CollectionInterface $collection, callable $callback = null ) : Generator
$collection Neos\Flow\ResourceManagement\CollectionInterface
$callback callable Function called after each iteration
return Generator

getStoragePathAndFilenameByHash() protected method

This function assures a nested directory structure in order to avoid thousands of files in a single directory which may result in performance problems in older file systems such as ext2, ext3 or NTFS.
protected getStoragePathAndFilenameByHash ( string $sha1Hash ) : string
$sha1Hash string The SHA1 hash identifying the stored resource
return string The path and filename, for example "/var/www/mysite.com/Data/Persistent/c/8/2/8/c828d0f88ce197be1aff7cc2e5e86b1244241ac6"

getStreamByResource() public method

Returns a stream handle which can be used internally to open / copy the given resource stored in this storage.
public getStreamByResource ( PersistentResource $resource ) : resource | boolean
$resource Neos\Flow\ResourceManagement\PersistentResource The resource stored in this storage
return resource | boolean | boolean The resource stream or FALSE if the stream could not be obtained

getStreamByResourcePath() public method

Returns a stream handle which can be used internally to open / copy the given resource stored in this storage.
public getStreamByResourcePath ( string $relativePath ) : resource | boolean
$relativePath string A path relative to the storage root, for example "MyFirstDirectory/SecondDirectory/Foo.css"
return resource | boolean | boolean A URI (for example the full path and filename) leading to the resource file or FALSE if it does not exist

initializeObject() public method

Initializes this resource storage
public initializeObject ( ) : void
return void

Property Details

$environment protected_oe property

protected Environment,Neos\Flow\Utility $environment
return Neos\Flow\Utility\Environment

$name protected_oe property

Name which identifies this resource storage
protected string $name
return string

$path protected_oe property

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

$resourceManager protected_oe property

protected ResourceManager,Neos\Flow\ResourceManagement $resourceManager
return Neos\Flow\ResourceManagement\ResourceManager

$resourceRepository protected_oe property

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