eZPublishCommunityProject  2013.9
eZ\Publish\Core\IO\Handler\Legacy Class Reference

Legacy Io/Storage handler, based on eZ Cluster. More...

+ Inheritance diagram for eZ\Publish\Core\IO\Handler\Legacy:
+ Collaboration diagram for eZ\Publish\Core\IO\Handler\Legacy:

Public Member Functions

 __construct ($storageDirectory, LegacyKernel $legacyKernel=null)
 
 create (BinaryFileCreateStruct $createStruct)
 Creates and stores a new BinaryFile based on the BinaryFileCreateStruct $file. More...
 
 delete ($spiBinaryFileId)
 Deletes the existing BinaryFile with path $path. More...
 
 exists ($spiBinaryFileId)
 Checks if the BinaryFile with path $path exists. More...
 
 getExternalPath ($path)
 Removes the internal storage path from $path. More...
 
 getFileContents ($spiBinaryFileId)
 Returns the contents of the BinaryFile identified by $path. More...
 
 getFileResource ($spiBinaryFileId)
 Returns a file resource to the BinaryFile identified by $path. More...
 
 getInternalPath ($spiBinaryFileId)
 Returns the internal, handler level path from the api level $binaryFileId. More...
 
 getUri ($spiBinaryFileId)
 Returns the file's public HTTP URI, as exposed from the outside. More...
 
 load ($spiBinaryFileId)
 Loads the BinaryFile identified by $path. More...
 
 setLegacyKernel (LegacyKernel $kernel)
 
 setLegacyKernelClosure (\Closure $kernelClosure)
 
 update ($spiBinaryFileId, BinaryFileUpdateStruct $updateFileStruct)
 Updates the file identified by $path with data from $updateFile. More...
 
- Public Member Functions inherited from eZ\Publish\Core\IO\Handler
 create (BinaryFileCreateStruct $createStruct)
 Creates and stores a new BinaryFile based on the BinaryFileCreateStruct $file. More...
 
 getMetadata (MetadataHandler $metadataHandler, $spiBinaryFileId)
 Executes $metadataHandler on $path, and returns the metadata array. More...
 

Protected Member Functions

 getDatatype ($mimeType)
 
 getLegacyKernel ()
 
 getMimeTypeFromLocalFile ($path)
 Returns a mimeType from a local file, using fileinfo. More...
 
 getScope ($path)
 Maps a URI to a scope. More...
 
 getStoragePath ($spiBinaryFileId)
 Transforms an SPI id in a storage path using the $storageDirectory. More...
 
 removeStoragePath ($path)
 

Private Member Functions

 getClusterHandler ($path=null)
 Lazy loads eZClusterFileHandler. More...
 
 getFileResourceProvider ()
 Returns the appropriate FileResourceProvider depending on the cluster handler in use. More...
 

Private Attributes

 $clusterHandler = null
 
 $fileResourceProvider = null
 
 $legacyKernel
 
 $legacyKernelClosure
 
 $storageDirectory
 

Detailed Description

Legacy Io/Storage handler, based on eZ Cluster.

Due to the legacy API, this handler has a few limitations:

  • ctime is not really supported, and will always have the same value as mtime
  • mtime can not be modified, and will always automatically be set depending on the server time upon each write operation

Constructor & Destructor Documentation

eZ\Publish\Core\IO\Handler\Legacy::__construct (   $storageDirectory,
LegacyKernel  $legacyKernel = null 
)

Member Function Documentation

eZ\Publish\Core\IO\Handler\Legacy::create ( BinaryFileCreateStruct  $createStruct)

Creates and stores a new BinaryFile based on the BinaryFileCreateStruct $file.

Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentExceptionIf the target path already exists
Parameters
\eZ\Publish\SPI\IO\BinaryFileCreateStruct$createStruct
Returns
The newly created BinaryFile object
eZ\Publish\Core\IO\Handler\Legacy::delete (   $spiBinaryFileId)

Deletes the existing BinaryFile with path $path.

Exceptions
\eZ\Publish\Core\Base\Exceptions\NotFoundExceptionIf the file doesn't exist
Parameters
string$spiBinaryFileId

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Legacy::exists (   $spiBinaryFileId)

Checks if the BinaryFile with path $path exists.

Parameters
string$spiBinaryFileId
Returns
boolean

Implements eZ\Publish\Core\IO\Handler.

Referenced by eZ\Publish\Core\IO\Handler\Legacy\create(), eZ\Publish\Core\IO\Handler\Legacy\delete(), and eZ\Publish\Core\IO\Handler\Legacy\update().

eZ\Publish\Core\IO\Handler\Legacy::getClusterHandler (   $path = null)
private

Lazy loads eZClusterFileHandler.

Parameters
string$path
Returns
eZClusterFileHandler

Referenced by eZ\Publish\Core\IO\Handler\Legacy\create(), eZ\Publish\Core\IO\Handler\Legacy\delete(), and eZ\Publish\Core\IO\Handler\Legacy\update().

eZ\Publish\Core\IO\Handler\Legacy::getDatatype (   $mimeType)
protected
eZ\Publish\Core\IO\Handler\Legacy::getExternalPath (   $apiBinaryFileId)

Removes the internal storage path from $path.

Parameters
string$apiBinaryFileId
Returns
string

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Legacy::getFileContents (   $spiBinaryFileId)

Returns the contents of the BinaryFile identified by $path.

Exceptions
\eZ\Publish\Core\Base\Exceptions\NotFoundExceptionif the file couldn't be found
Parameters
string$spiBinaryFileId
Returns
string

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Legacy::getFileResource (   $spiBinaryFileId)

Returns a file resource to the BinaryFile identified by $path.

Parameters
string$spiBinaryFileId
Exceptions
NotFoundExceptionif $path doesn't exist
Returns
resource

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Legacy::getFileResourceProvider ( )
private

Returns the appropriate FileResourceProvider depending on the cluster handler in use.

Exceptions
\Exception
Returns
eZ\Publish\Core\IO\Handler\Legacy::getInternalPath (   $spiBinaryFileId)

Returns the internal, handler level path from the api level $binaryFileId.

Parameters
string$spiBinaryFileId
Returns
string

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Legacy::getLegacyKernel ( )
protected
eZ\Publish\Core\IO\Handler\Legacy::getMimeTypeFromLocalFile (   $path)
protected

Returns a mimeType from a local file, using fileinfo.

Exceptions
\eZ\Publish\Core\Base\Exceptions\NotFoundExceptionIf file does not exist
Todo:
If legacy path is made available then this function can use that to skip executing legacy kernel
Parameters
string$path
Returns
string
eZ\Publish\Core\IO\Handler\Legacy::getScope (   $path)
protected

Maps a URI to a scope.

Note that mediafile & binaryfile can't be distinguished from each other using the path alone, since they're stored in the same directory. We consider that a file of mimetype media will be a mediafile, and other binary files will be scoped binaryfile

Exceptions
InvalidArgumentExceptionIf $path isn't a legacy compatible storage path
Parameters
string$path
Returns
string|false The scope, defaulting to UNKNOWN_SCOPE

Referenced by eZ\Publish\Core\IO\Handler\Legacy\create().

eZ\Publish\Core\IO\Handler\Legacy::getStoragePath (   $spiBinaryFileId)
protected

Transforms an SPI id in a storage path using the $storageDirectory.

Parameters
string$spiBinaryFileId
Returns
string

Referenced by eZ\Publish\Core\IO\Handler\Legacy\create(), eZ\Publish\Core\IO\Handler\Legacy\delete(), and eZ\Publish\Core\IO\Handler\Legacy\update().

eZ\Publish\Core\IO\Handler\Legacy::getUri (   $spiBinaryFileId)

Returns the file's public HTTP URI, as exposed from the outside.

Deprecated:
should not be required. Seek & destroy.
Parameters
string$spiBinaryFileId
Returns
string

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Legacy::load (   $spiBinaryFileId)

Loads the BinaryFile identified by $path.

Exceptions
\eZ\Publish\Core\Base\Exceptions\NotFoundExceptionIf no file identified by $path exists
Parameters
string$spiBinaryFileId
Returns

Implements eZ\Publish\Core\IO\Handler.

Referenced by eZ\Publish\Core\IO\Handler\Legacy\create().

eZ\Publish\Core\IO\Handler\Legacy::removeStoragePath (   $path)
protected
Parameters
string$path
Returns
string spiBinaryFileId
Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentException
eZ\Publish\Core\IO\Handler\Legacy::setLegacyKernel ( LegacyKernel  $kernel)
eZ\Publish\Core\IO\Handler\Legacy::setLegacyKernelClosure ( \Closure  $kernelClosure)
eZ\Publish\Core\IO\Handler\Legacy::update (   $spiBinaryFileId,
BinaryFileUpdateStruct  $updateFileStruct 
)

Updates the file identified by $path with data from $updateFile.

Exceptions
\eZ\Publish\Core\Base\Exceptions\NotFoundExceptionIf the source path doesn't exist
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentExceptionIf the target path already exists
Parameters
string$spiBinaryFileId
\eZ\Publish\SPI\IO\BinaryFileUpdateStruct$updateFileStruct
Returns
The updated BinaryFile

Implements eZ\Publish\Core\IO\Handler.

Member Data Documentation

eZ\Publish\Core\IO\Handler\Legacy::$clusterHandler = null
private
eZ\Publish\Core\IO\Handler\Legacy::$fileResourceProvider = null
private
eZ\Publish\Core\IO\Handler\Legacy::$legacyKernel
private
eZ\Publish\Core\IO\Handler\Legacy::$legacyKernelClosure
private
eZ\Publish\Core\IO\Handler\Legacy::$storageDirectory
private

The documentation for this class was generated from the following file: