TYPO3  7.6
Public Member Functions | List of all members
DriverInterface Interface Reference
Inheritance diagram for DriverInterface:
AbstractDriver AbstractHierarchicalFilesystemDriver LocalDriver

Public Member Functions

 processConfiguration ()
 
 setStorageUid ($storageUid)
 
 initialize ()
 
 getCapabilities ()
 
 mergeConfigurationCapabilities ($capabilities)
 
 hasCapability ($capability)
 
 isCaseSensitiveFileSystem ()
 
 sanitizeFileName ($fileName, $charset= '')
 
 hashIdentifier ($identifier)
 
 getRootLevelFolder ()
 
 getDefaultFolder ()
 
 getParentFolderIdentifierOfIdentifier ($fileIdentifier)
 
 getPublicUrl ($identifier)
 
 createFolder ($newFolderName, $parentFolderIdentifier= '', $recursive=false)
 
 renameFolder ($folderIdentifier, $newName)
 
 deleteFolder ($folderIdentifier, $deleteRecursively=false)
 
 fileExists ($fileIdentifier)
 
 folderExists ($folderIdentifier)
 
 isFolderEmpty ($folderIdentifier)
 
 addFile ($localFilePath, $targetFolderIdentifier, $newFileName= '', $removeOriginal=true)
 
 createFile ($fileName, $parentFolderIdentifier)
 
 copyFileWithinStorage ($fileIdentifier, $targetFolderIdentifier, $fileName)
 
 renameFile ($fileIdentifier, $newName)
 
 replaceFile ($fileIdentifier, $localFilePath)
 
 deleteFile ($fileIdentifier)
 
 hash ($fileIdentifier, $hashAlgorithm)
 
 moveFileWithinStorage ($fileIdentifier, $targetFolderIdentifier, $newFileName)
 
 moveFolderWithinStorage ($sourceFolderIdentifier, $targetFolderIdentifier, $newFolderName)
 
 copyFolderWithinStorage ($sourceFolderIdentifier, $targetFolderIdentifier, $newFolderName)
 
 getFileContents ($fileIdentifier)
 
 setFileContents ($fileIdentifier, $contents)
 
 fileExistsInFolder ($fileName, $folderIdentifier)
 
 folderExistsInFolder ($folderName, $folderIdentifier)
 
 getFileForLocalProcessing ($fileIdentifier, $writable=true)
 
 getPermissions ($identifier)
 
 dumpFileContents ($identifier)
 
 isWithin ($folderIdentifier, $identifier)
 
 getFileInfoByIdentifier ($fileIdentifier, array $propertiesToExtract=array())
 
 getFolderInfoByIdentifier ($folderIdentifier)
 
 getFileInFolder ($fileName, $folderIdentifier)
 
 getFilesInFolder ($folderIdentifier, $start=0, $numberOfItems=0, $recursive=false, array $filenameFilterCallbacks=array(), $sort= '', $sortRev=false)
 
 getFolderInFolder ($folderName, $folderIdentifier)
 
 getFoldersInFolder ($folderIdentifier, $start=0, $numberOfItems=0, $recursive=false, array $folderNameFilterCallbacks=array(), $sort= '', $sortRev=false)
 
 countFilesInFolder ($folderIdentifier, $recursive=false, array $filenameFilterCallbacks=array())
 
 countFoldersInFolder ($folderIdentifier, $recursive=false, array $folderNameFilterCallbacks=array())
 

Detailed Description

An interface Drivers have to implement to fulfil the needs of the FAL API.

Definition at line 22 of file DriverInterface.php.

Member Function Documentation

addFile (   $localFilePath,
  $targetFolderIdentifier,
  $newFileName = '',
  $removeOriginal = true 
)

Adds a file from the local server hard disk to a given path in TYPO3s virtual file system. This assumes that the local file exists, so no further check is done here! After a successful the original file must not exist anymore.

Parameters
string$localFilePath(within PATH_site)
string$targetFolderIdentifier
string$newFileNameoptional, if not given original name is used
bool$removeOriginalif set the original file will be removed after successful operation
Returns
string the identifier of the new file

Implemented in LocalDriver.

copyFileWithinStorage (   $fileIdentifier,
  $targetFolderIdentifier,
  $fileName 
)

Copies a file within the current storage. Note that this is only about an inner storage copy action, where a file is just copied to another folder in the same storage.

Parameters
string$fileIdentifier
string$targetFolderIdentifier
string$fileName
Returns
string the Identifier of the new file

Implemented in LocalDriver.

copyFolderWithinStorage (   $sourceFolderIdentifier,
  $targetFolderIdentifier,
  $newFolderName 
)

Folder equivalent to copyFileWithinStorage().

Parameters
string$sourceFolderIdentifier
string$targetFolderIdentifier
string$newFolderName
Returns
bool
countFilesInFolder (   $folderIdentifier,
  $recursive = false,
array  $filenameFilterCallbacks = array() 
)

Returns the number of files inside the specified path

Parameters
string$folderIdentifier
bool$recursive
array$filenameFilterCallbackscallbacks for filtering the items
Returns
int Number of files in folder

Implemented in LocalDriver.

countFoldersInFolder (   $folderIdentifier,
  $recursive = false,
array  $folderNameFilterCallbacks = array() 
)

Returns the number of folders inside the specified path

Parameters
string$folderIdentifier
bool$recursive
array$folderNameFilterCallbackscallbacks for filtering the items
Returns
int Number of folders in folder

Implemented in LocalDriver.

createFile (   $fileName,
  $parentFolderIdentifier 
)

Creates a new (empty) file and returns the identifier.

Parameters
string$fileName
string$parentFolderIdentifier
Returns
string

Implemented in LocalDriver.

createFolder (   $newFolderName,
  $parentFolderIdentifier = '',
  $recursive = false 
)

Creates a folder, within a parent folder. If no parent folder is given, a root level folder will be created

Parameters
string$newFolderName
string$parentFolderIdentifier
bool$recursive
Returns
string the Identifier of the new folder

Implemented in LocalDriver.

deleteFile (   $fileIdentifier)

Removes a file from the filesystem. This does not check if the file is still used or if it is a bad idea to delete it for some other reason this has to be taken care of in the upper layers (e.g. the Storage)!

Parameters
string$fileIdentifier
Returns
bool TRUE if deleting the file succeeded

Implemented in LocalDriver.

deleteFolder (   $folderIdentifier,
  $deleteRecursively = false 
)

Removes a folder in filesystem.

Parameters
string$folderIdentifier
bool$deleteRecursively
Returns
bool

Implemented in LocalDriver.

dumpFileContents (   $identifier)

Directly output the contents of the file to the output buffer. Should not take care of header files or flushing buffer before. Will be taken care of by the Storage.

Parameters
string$identifier
Returns
void

Implemented in LocalDriver.

fileExists (   $fileIdentifier)

Checks if a file exists.

Parameters
string$fileIdentifier
Returns
bool

Implemented in LocalDriver.

fileExistsInFolder (   $fileName,
  $folderIdentifier 
)

Checks if a file inside a folder exists

Parameters
string$fileName
string$folderIdentifier
Returns
bool

Implemented in LocalDriver.

folderExists (   $folderIdentifier)

Checks if a folder exists.

Parameters
string$folderIdentifier
Returns
bool

Implemented in LocalDriver.

folderExistsInFolder (   $folderName,
  $folderIdentifier 
)

Checks if a folder inside a folder exists.

Parameters
string$folderName
string$folderIdentifier
Returns
bool

Implemented in LocalDriver.

getCapabilities ( )

Returns the capabilities of this driver.

Returns
int
See Also
Storage::CAPABILITY_* constants

Implemented in AbstractDriver.

getDefaultFolder ( )

Returns the identifier of the default folder new files should be put into.

Returns
string

Implemented in LocalDriver.

getFileContents (   $fileIdentifier)

Returns the contents of a file. Beware that this requires to load the complete file into memory and also may require fetching the file from an external location. So this might be an expensive operation (both in terms of processing resources and money) for large files.

Parameters
string$fileIdentifier
Returns
string The file contents

Implemented in LocalDriver.

getFileForLocalProcessing (   $fileIdentifier,
  $writable = true 
)

Returns a path to a local copy of a file for processing it. When changing the file, you have to take care of replacing the current version yourself!

Parameters
string$fileIdentifier
bool$writableSet this to FALSE if you only need the file for read operations. This might speed up things, e.g. by using a cached local version. Never modify the file if you have set this flag!
Returns
string The path to the file on the local disk

Implemented in LocalDriver.

getFileInfoByIdentifier (   $fileIdentifier,
array  $propertiesToExtract = array() 
)

Returns information about a file.

Parameters
string$fileIdentifier
array$propertiesToExtractArray of properties which are be extracted If empty all will be extracted
Returns
array

Implemented in LocalDriver.

getFileInFolder (   $fileName,
  $folderIdentifier 
)

Returns the identifier of a file inside the folder

Parameters
string$fileName
string$folderIdentifier
Returns
string file identifier

Implemented in LocalDriver.

getFilesInFolder (   $folderIdentifier,
  $start = 0,
  $numberOfItems = 0,
  $recursive = false,
array  $filenameFilterCallbacks = array(),
  $sort = '',
  $sortRev = false 
)

Returns a list of files inside the specified path

Parameters
string$folderIdentifier
int$start
int$numberOfItems
bool$recursive
array$filenameFilterCallbackscallbacks for filtering the items
string$sortProperty name used to sort the items. Among them may be: '' (empty, no sorting), name, fileext, size, tstamp and rw. If a driver does not support the given property, it should fall back to "name".
bool$sortRevTRUE to indicate reverse sorting (last to first)
Returns
array of FileIdentifiers

Implemented in LocalDriver.

getFolderInfoByIdentifier (   $folderIdentifier)

Returns information about a file.

Parameters
string$folderIdentifier
Returns
array

Implemented in LocalDriver.

getFolderInFolder (   $folderName,
  $folderIdentifier 
)

Returns the identifier of a folder inside the folder

Parameters
string$folderNameThe name of the target folder
string$folderIdentifier
Returns
string folder identifier

Implemented in LocalDriver.

getFoldersInFolder (   $folderIdentifier,
  $start = 0,
  $numberOfItems = 0,
  $recursive = false,
array  $folderNameFilterCallbacks = array(),
  $sort = '',
  $sortRev = false 
)

Returns a list of folders inside the specified path

Parameters
string$folderIdentifier
int$start
int$numberOfItems
bool$recursive
array$folderNameFilterCallbackscallbacks for filtering the items
string$sortProperty name used to sort the items. Among them may be: '' (empty, no sorting), name, fileext, size, tstamp and rw. If a driver does not support the given property, it should fall back to "name".
bool$sortRevTRUE to indicate reverse sorting (last to first)
Returns
array of Folder Identifier

Implemented in LocalDriver.

getParentFolderIdentifierOfIdentifier (   $fileIdentifier)

Returns the identifier of the folder the file resides in

Parameters
string$fileIdentifier
Returns
string

Implemented in AbstractHierarchicalFilesystemDriver.

getPermissions (   $identifier)

Returns the permissions of a file/folder as an array (keys r, w) of boolean flags

Parameters
string$identifier
Returns
array

Implemented in LocalDriver.

getPublicUrl (   $identifier)

Returns the public URL to a file. Either fully qualified URL or relative to PATH_site (rawurlencoded).

Parameters
string$identifier
Returns
string

Implemented in LocalDriver.

getRootLevelFolder ( )

Returns the identifier of the root level folder of the storage.

Returns
string

Implemented in LocalDriver.

hasCapability (   $capability)

Returns TRUE if this driver has the given capability.

Parameters
int$capabilityA capability, as defined in a CAPABILITY_* constant
Returns
bool

Implemented in AbstractDriver.

hash (   $fileIdentifier,
  $hashAlgorithm 
)

Creates a hash for a file.

Parameters
string$fileIdentifier
string$hashAlgorithmThe hash algorithm to use
Returns
string

Implemented in LocalDriver.

hashIdentifier (   $identifier)

Hashes a file identifier, taking the case sensitivity of the file system into account. This helps mitigating problems with case-insensitive databases.

Parameters
string$identifier
Returns
string

Implemented in AbstractDriver.

initialize ( )

Initializes this object. This is called by the storage after the driver has been attached.

Returns
void

Implemented in LocalDriver.

isCaseSensitiveFileSystem ( )

Returns TRUE if this driver uses case-sensitive identifiers. NOTE: This is a configurable setting, but the setting does not change the way the underlying file system treats the identifiers; the setting should therefore always reflect the file system and not try to change its behaviour

Returns
bool

Implemented in AbstractDriver.

isFolderEmpty (   $folderIdentifier)

Checks if a folder contains files and (if supported) other folders.

Parameters
string$folderIdentifier
Returns
bool TRUE if there are no files and folders within $folder

Implemented in LocalDriver.

isWithin (   $folderIdentifier,
  $identifier 
)

Checks if a given identifier is within a container, e.g. if a file or folder is within another folder. This can e.g. be used to check for web-mounts.

Hint: this also needs to return TRUE if the given identifier matches the container identifier to allow access to the root folder of a filemount.

Parameters
string$folderIdentifier
string$identifieridentifier to be checked against $folderIdentifier
Returns
bool TRUE if $content is within or matches $folderIdentifier

Implemented in LocalDriver.

mergeConfigurationCapabilities (   $capabilities)

Merges the capabilities merged by the user at the storage configuration into the actual capabilities of the driver and returns the result.

Parameters
int$capabilities
Returns
int

Implemented in LocalDriver.

moveFileWithinStorage (   $fileIdentifier,
  $targetFolderIdentifier,
  $newFileName 
)

Moves a file within the current storage. Note that this is only about an inner-storage move action, where a file is just moved to another folder in the same storage.

Parameters
string$fileIdentifier
string$targetFolderIdentifier
string$newFileName
Returns
string

Implemented in LocalDriver.

moveFolderWithinStorage (   $sourceFolderIdentifier,
  $targetFolderIdentifier,
  $newFolderName 
)

Folder equivalent to moveFileWithinStorage().

Parameters
string$sourceFolderIdentifier
string$targetFolderIdentifier
string$newFolderName
Returns
array All files which are affected, map of old => new file identifiers

Implemented in LocalDriver.

processConfiguration ( )

Processes the configuration for this driver.

Returns
void

Implemented in LocalDriver.

renameFile (   $fileIdentifier,
  $newName 
)

Renames a file in this storage.

Parameters
string$fileIdentifier
string$newNameThe target path (including the file name!)
Returns
string The identifier of the file after renaming

Implemented in LocalDriver.

renameFolder (   $folderIdentifier,
  $newName 
)

Renames a folder in this storage.

Parameters
string$folderIdentifier
string$newName
Returns
array A map of old to new file identifiers of all affected resources

Implemented in LocalDriver.

replaceFile (   $fileIdentifier,
  $localFilePath 
)

Replaces a file with file in local file system.

Parameters
string$fileIdentifier
string$localFilePath
Returns
bool TRUE if the operation succeeded

Implemented in LocalDriver.

sanitizeFileName (   $fileName,
  $charset = '' 
)

Cleans a fileName from not allowed characters

Parameters
string$fileName
string$charsetCharset of the a fileName (defaults to current charset; depending on context)
Returns
string the cleaned filename

Implemented in LocalDriver, and AbstractDriver.

setFileContents (   $fileIdentifier,
  $contents 
)

Sets the contents of a file to the specified value.

Parameters
string$fileIdentifier
string$contents
Returns
int The number of bytes written to the file

Implemented in LocalDriver.

setStorageUid (   $storageUid)

Sets the storage uid the driver belongs to

Parameters
int$storageUid
Returns
void

Implemented in AbstractDriver.