PHP 클래스 Neos\Flow\ResourceManagement\ResourceManager

파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$collections array
$environment Neos\Flow\Utility\Environment
$initialized boolean
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$resourceRepository ResourceRepository
$settings array
$storages array
$systemLogger Neos\Flow\Log\SystemLoggerInterface
$targets array

공개 메소드들

메소드 설명
createResourceFromContent ( string $content, string $filename ) : PersistentResource Creates a resource from the given binary content as a persistent resource.
deleteResource ( PersistentResource $resource, boolean $unpublishResource = true ) : boolean Deletes the given PersistentResource from the ResourceRepository and, if the storage data is no longer used in another PersistentResource object, also deletes the data from the storage.
getCollection ( string $collectionName ) : Neos\Flow\ResourceManagement\CollectionInterface Returns a Collection instance by the given name
getCollections ( ) : array Returns an array of currently known Collection instances
getCollectionsByStorage ( Neos\Flow\ResourceManagement\Storage\StorageInterface $storage ) : array Returns an array of Collection instances which use the given storage
getImportedResources ( ) : SplObjectStorage Returns an object storage with all resource objects which have been imported by the ResourceManager during this script call. Each resource comes with an array of additional information about its import.
getPackageAndPathByPublicPath ( string $path ) : array Return the package key and the relative path and filename from the given resource path
getPublicPackageResourceUri ( string $packageKey, string $relativePathAndFilename ) : string Returns the public URI for a static resource provided by the specified package and in the given path below the package's resources directory.
getPublicPackageResourceUriByPath ( string $path ) : string Returns the public URI for a static resource provided by the public package
getPublicPersistentResourceUri ( PersistentResource $resource ) : string | boolean Returns the web accessible URI for the given resource object
getPublicPersistentResourceUriByHash ( string $resourceHash, string $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME ) : string Returns the web accessible URI for the resource object specified by the given SHA1 hash.
getResourceBySha1 ( string $sha1Hash ) : PersistentResource | null Returns the resource object identified by the given SHA1 hash over the content, or NULL if no such PersistentResource object is known yet.
getStorage ( string $storageName ) : Neos\Flow\ResourceManagement\Storage\StorageInterface Returns a Storage instance by the given name
getStreamByResource ( PersistentResource $resource ) : resource | boolean Returns a stream handle of the given persistent resource which allows for opening / copying the resource's data. Note that this stream handle may only be used read-only.
importResource ( string | resource $source, string $collectionName = ResourceManager::DEFAULT_PERSISTENT_COLLECTION_NAME, string $forcedPersistenceObjectIdentifier = null ) : PersistentResource Imports a resource (file) from the given location as a persistent resource.
importResourceFromContent ( string $content, string $filename, string $collectionName = ResourceManager::DEFAULT_PERSISTENT_COLLECTION_NAME, string $forcedPersistenceObjectIdentifier = null ) : PersistentResource Imports the given content passed as a string as a new persistent resource.
importUploadedResource ( array $uploadInfo, string $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME ) : PersistentResource Imports a resource (file) from the given upload info array as a persistent resource.
injectSettings ( array $settings ) : void Injects the settings of this package
shutdownObject ( ) : void Checks if recently imported resources really have been persisted - and if not, removes its data from the respective storage.

보호된 메소드들

메소드 설명
initialize ( ) : void Initializes the ResourceManager by parsing the related configuration and registering the resource stream wrapper.
initializeCollections ( ) : void Initializes the Collection objects according to the current settings
initializeStorages ( ) : void Initializes the Storage objects according to the current settings
initializeTargets ( ) : void Initializes the Target objects according to the current settings
prepareUploadedFileForImport ( array $uploadInfo ) : array Prepare an uploaded file to be imported as resource object. Will check the validity of the file, move it outside of upload folder if open_basedir is enabled and check the filename.

메소드 상세

createResourceFromContent() 공개 메소드

Creates a resource from the given binary content as a persistent resource.
또한 보기: importResourceFromContent()
사용 중단: use importResourceFromContent() instead
public createResourceFromContent ( string $content, string $filename ) : PersistentResource
$content string The binary content to import
$filename string The filename to use for the newly generated resource
리턴 PersistentResource A resource object representing the created resource or FALSE if an error occurred.

deleteResource() 공개 메소드

This method will also remove the PersistentResource object from the (internal) ResourceRepository.
public deleteResource ( PersistentResource $resource, boolean $unpublishResource = true ) : boolean
$resource PersistentResource The resource to delete
$unpublishResource boolean If the resource should be unpublished before deleting it from the storage
리턴 boolean true if the resource was deleted, otherwise FALSE

getCollection() 공개 메소드

Returns a Collection instance by the given name
public getCollection ( string $collectionName ) : Neos\Flow\ResourceManagement\CollectionInterface
$collectionName string Name of the collection as defined in the settings
리턴 Neos\Flow\ResourceManagement\CollectionInterface or NULL

getCollections() 공개 메소드

Returns an array of currently known Collection instances
public getCollections ( ) : array
리턴 array

getCollectionsByStorage() 공개 메소드

Returns an array of Collection instances which use the given storage
public getCollectionsByStorage ( Neos\Flow\ResourceManagement\Storage\StorageInterface $storage ) : array
$storage Neos\Flow\ResourceManagement\Storage\StorageInterface
리턴 array

getImportedResources() 공개 메소드

Example for a returned object storage: $resource1 => array('originalFilename' => 'Foo.txt'), $resource2 => array('originalFilename' => 'Bar.txt'), ...
public getImportedResources ( ) : SplObjectStorage
리턴 SplObjectStorage

getPackageAndPathByPublicPath() 공개 메소드

Return the package key and the relative path and filename from the given resource path
public getPackageAndPathByPublicPath ( string $path ) : array
$path string The ressource path, like resource://Your.Package/Public/Image/Dummy.png
리턴 array The array contains two value, first the packageKey followed by the relativePathAndFilename

getPublicPackageResourceUri() 공개 메소드

Returns the public URI for a static resource provided by the specified package and in the given path below the package's resources directory.
public getPublicPackageResourceUri ( string $packageKey, string $relativePathAndFilename ) : string
$packageKey string Package key
$relativePathAndFilename string A relative path below the "Resources" directory of the package
리턴 string

getPublicPackageResourceUriByPath() 공개 메소드

Returns the public URI for a static resource provided by the public package
public getPublicPackageResourceUriByPath ( string $path ) : string
$path string The ressource path, like resource://Your.Package/Public/Image/Dummy.png
리턴 string

getPublicPersistentResourceUri() 공개 메소드

Returns the web accessible URI for the given resource object
public getPublicPersistentResourceUri ( PersistentResource $resource ) : string | boolean
$resource PersistentResource The resource object
리턴 string | boolean A URI as a string or FALSE if the collection of the resource is not found

getPublicPersistentResourceUriByHash() 공개 메소드

Returns the web accessible URI for the resource object specified by the given SHA1 hash.
public getPublicPersistentResourceUriByHash ( string $resourceHash, string $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME ) : string
$resourceHash string The SHA1 hash identifying the resource content
$collectionName string Name of the collection the resource is part of
리턴 string A URI as a string

getResourceBySha1() 공개 메소드

Returns the resource object identified by the given SHA1 hash over the content, or NULL if no such PersistentResource object is known yet.
public getResourceBySha1 ( string $sha1Hash ) : PersistentResource | null
$sha1Hash string The SHA1 identifying the data the PersistentResource stands for
리턴 PersistentResource | null

getStorage() 공개 메소드

Returns a Storage instance by the given name
public getStorage ( string $storageName ) : Neos\Flow\ResourceManagement\Storage\StorageInterface
$storageName string Name of the storage as defined in the settings
리턴 Neos\Flow\ResourceManagement\Storage\StorageInterface or NULL

getStreamByResource() 공개 메소드

Returns a stream handle of the given persistent resource which allows for opening / copying the resource's data. Note that this stream handle may only be used read-only.
public getStreamByResource ( PersistentResource $resource ) : resource | boolean
$resource PersistentResource The resource to retrieve the stream for
리턴 resource | boolean The resource stream or FALSE if the stream could not be obtained

importResource() 공개 메소드

On a successful import this method returns a PersistentResource object representing the newly imported persistent resource and automatically publishes it to the configured publication target.
public importResource ( string | resource $source, string $collectionName = ResourceManager::DEFAULT_PERSISTENT_COLLECTION_NAME, string $forcedPersistenceObjectIdentifier = null ) : PersistentResource
$source string | resource A URI (can therefore also be a path and filename) or a PHP resource stream(!) pointing to the PersistentResource to import
$collectionName string Name of the collection this new resource should be added to. By default the standard collection for persistent resources is used.
$forcedPersistenceObjectIdentifier string INTERNAL: Force the object identifier for this resource to the given UUID
리턴 PersistentResource A resource object representing the imported resource

importResourceFromContent() 공개 메소드

The given content typically is binary data or a text format. On a successful import this method returns a PersistentResource object representing the imported content and automatically publishes it to the configured publication target. The specified filename will be used when presenting the resource to a user. Its file extension is important because the resource management will derive the IANA Media Type from it.
public importResourceFromContent ( string $content, string $filename, string $collectionName = ResourceManager::DEFAULT_PERSISTENT_COLLECTION_NAME, string $forcedPersistenceObjectIdentifier = null ) : PersistentResource
$content string The binary content to import
$filename string The filename to use for the newly generated resource
$collectionName string Name of the collection this new resource should be added to. By default the standard collection for persistent resources is used.
$forcedPersistenceObjectIdentifier string INTERNAL: Force the object identifier for this resource to the given UUID
리턴 PersistentResource A resource object representing the imported resource

importUploadedResource() 공개 메소드

On a successful import this method returns a PersistentResource object representing the newly imported persistent resource.
public importUploadedResource ( array $uploadInfo, string $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME ) : PersistentResource
$uploadInfo array An array detailing the resource to import (expected keys: name, tmp_name)
$collectionName string Name of the collection this uploaded resource should be added to
리턴 PersistentResource A resource object representing the imported resource

initialize() 보호된 메소드

Initializes the ResourceManager by parsing the related configuration and registering the resource stream wrapper.
protected initialize ( ) : void
리턴 void

initializeCollections() 보호된 메소드

Initializes the Collection objects according to the current settings
protected initializeCollections ( ) : void
리턴 void

initializeStorages() 보호된 메소드

Initializes the Storage objects according to the current settings
protected initializeStorages ( ) : void
리턴 void

initializeTargets() 보호된 메소드

Initializes the Target objects according to the current settings
protected initializeTargets ( ) : void
리턴 void

injectSettings() 공개 메소드

Injects the settings of this package
public injectSettings ( array $settings ) : void
$settings array
리턴 void

prepareUploadedFileForImport() 보호된 메소드

Prepare an uploaded file to be imported as resource object. Will check the validity of the file, move it outside of upload folder if open_basedir is enabled and check the filename.
protected prepareUploadedFileForImport ( array $uploadInfo ) : array
$uploadInfo array
리턴 array Array of string with the two keys "filepath" (the path to get the filecontent from) and "filename" the filename of the originally uploaded file.

shutdownObject() 공개 메소드

Checks if recently imported resources really have been persisted - and if not, removes its data from the respective storage.
public shutdownObject ( ) : void
리턴 void

프로퍼티 상세

$collections 보호되어 있는 프로퍼티

protected array $collections
리턴 array

$environment 보호되어 있는 프로퍼티

protected Environment,Neos\Flow\Utility $environment
리턴 Neos\Flow\Utility\Environment

$initialized 보호되어 있는 프로퍼티

protected bool $initialized
리턴 boolean

$objectManager 보호되어 있는 프로퍼티

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
리턴 Neos\Flow\ObjectManagement\ObjectManagerInterface

$persistenceManager 보호되어 있는 프로퍼티

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
리턴 Neos\Flow\Persistence\PersistenceManagerInterface

$resourceRepository 보호되어 있는 프로퍼티

protected ResourceRepository,Neos\Flow\ResourceManagement $resourceRepository
리턴 ResourceRepository

$settings 보호되어 있는 프로퍼티

protected array $settings
리턴 array

$storages 보호되어 있는 프로퍼티

protected array $storages
리턴 array

$systemLogger 보호되어 있는 프로퍼티

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
리턴 Neos\Flow\Log\SystemLoggerInterface

$targets 보호되어 있는 프로퍼티

protected array $targets
리턴 array