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

Public Member Functions

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

Public Attributes

const UNSAFE_FILENAME_CHARACTER_EXPRESSION = '\\x00-\\x2C\\/\\x3A-\\x3F\\x5B-\\x60\\x7B-\\xBF'
 

Protected Member Functions

 determineBaseUrl ()
 
 calculateBasePath (array $configuration)
 
 getDirectoryItemList ($folderIdentifier, $start=0, $numberOfItems=0, array $filterMethods, $includeFiles=true, $includeDirs=true, $recursive=false, $sort= '', $sortRev=false)
 
 applyFilterMethodsToDirectoryItem (array $filterMethods, $itemName, $itemIdentifier, $parentIdentifier)
 
 sortDirectoryEntries ($directoryEntries, $sort= '', $sortRev=false)
 
 extractFileInformation ($filePath, $containerPath, array $propertiesToExtract=array())
 
 getAbsoluteBasePath ()
 
 getAbsolutePath ($fileIdentifier)
 
 copyFileToTemporaryPath ($fileIdentifier)
 
 createIdentifierMap (array $filesAndFolders, $sourceFolderIdentifier, $targetFolderIdentifier)
 
 getCharsetConversion ()
 
- Protected Member Functions inherited from AbstractHierarchicalFilesystemDriver
 isPathValid ($theFile)
 
 canonicalizeAndCheckFilePath ($filePath)
 
 canonicalizeAndCheckFileIdentifier ($fileIdentifier)
 
 canonicalizeAndCheckFolderIdentifier ($folderPath)
 
- Protected Member Functions inherited from AbstractDriver
 isValidFilename ($fileName)
 
 getTemporaryPathForFile ($fileIdentifier)
 
 canonicalizeAndCheckFilePath ($filePath)
 
 canonicalizeAndCheckFileIdentifier ($fileIdentifier)
 
 canonicalizeAndCheckFolderIdentifier ($folderIdentifier)
 

Protected Attributes

 $absoluteBasePath
 
 $supportedHashAlgorithms = array('sha1', 'md5')
 
 $baseUri = null
 
 $charsetConversion
 
 $mappingFolderNameToRole
 

Detailed Description

Driver for the local file system

Definition at line 28 of file LocalDriver.php.

Constructor & Destructor Documentation

__construct ( array  $configuration = array())

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
Exceptions
\RuntimeException
\InvalidArgumentException

Implements DriverInterface.

Definition at line 768 of file LocalDriver.php.

References PathUtility\basename(), AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFilePath(), AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), GeneralUtility\fixPermissions(), LocalDriver\getAbsolutePath(), GeneralUtility\isFirstPartOfStr(), and LocalDriver\sanitizeFileName().

applyFilterMethodsToDirectoryItem ( array  $filterMethods,
  $itemName,
  $itemIdentifier,
  $parentIdentifier 
)
protected

Applies a set of filter methods to a file name to find out if it should be used or not. This is e.g. used by directory listings.

Parameters
array$filterMethodsThe filter methods to use
string$itemName
string$itemIdentifier
string$parentIdentifier
Exceptions
\RuntimeException
Returns
bool

Definition at line 425 of file LocalDriver.php.

References elseif.

Referenced by LocalDriver\getDirectoryItemList().

calculateBasePath ( array  $configuration)
protected

Calculates the absolute path to this drivers storage location.

Exceptions
Exception\InvalidConfigurationException
Parameters
array$configuration
Returns
string

Definition at line 154 of file LocalDriver.php.

References LocalDriver\$absoluteBasePath, and AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFilePath().

Referenced by LocalDriver\processConfiguration().

copyFileToTemporaryPath (   $fileIdentifier)
protected

Copies a file to a temporary path and returns that path.

Parameters
string$fileIdentifier
Returns
string The temporary path
Exceptions
\RuntimeException

Definition at line 937 of file LocalDriver.php.

References LocalDriver\getAbsolutePath(), and AbstractDriver\getTemporaryPathForFile().

Referenced by LocalDriver\getFileForLocalProcessing().

copyFileWithinStorage (   $fileIdentifier,
  $targetFolderIdentifier,
  $fileName 
)

Copies a file within the current storage. Note that this is only about an intra-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

Implements DriverInterface.

Definition at line 895 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), GeneralUtility\fixPermissions(), and LocalDriver\getAbsolutePath().

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

Implements DriverInterface.

Definition at line 483 of file LocalDriver.php.

References LocalDriver\getFilesInFolder().

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

Implements DriverInterface.

Definition at line 517 of file LocalDriver.php.

References LocalDriver\getFoldersInFolder().

createFile (   $fileName,
  $parentFolderIdentifier 
)

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

Parameters
string$fileName
string$parentFolderIdentifier
Returns
string
Exceptions
Exception\InvalidFileNameException
\RuntimeException

Implements DriverInterface.

Definition at line 1272 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), GeneralUtility\fixPermissions(), LocalDriver\getAbsolutePath(), AbstractDriver\isValidFilename(), and LocalDriver\sanitizeFileName().

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

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

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

Implements DriverInterface.

Definition at line 234 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), LocalDriver\getAbsolutePath(), GeneralUtility\mkdir(), GeneralUtility\mkdir_deep(), LocalDriver\sanitizeFileName(), and GeneralUtility\trimExplode().

Referenced by LocalDriver\getDefaultFolder().

createIdentifierMap ( array  $filesAndFolders,
  $sourceFolderIdentifier,
  $targetFolderIdentifier 
)
protected

Creates a map of old and new file/folder identifiers after renaming or moving a folder. The old identifier is used as the key, the new one as the value.

Parameters
array$filesAndFolders
string$sourceFolderIdentifier
string$targetFolderIdentifier
Returns
array
Exceptions
Exception\FileOperationErrorException

Definition at line 963 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), and LocalDriver\getAbsolutePath().

Referenced by LocalDriver\moveFolderWithinStorage(), and LocalDriver\renameFolder().

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
Exceptions
\RuntimeException

Implements DriverInterface.

Definition at line 1147 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

deleteFolder (   $folderIdentifier,
  $deleteRecursively = false 
)

Removes a folder from this storage.

Parameters
string$folderIdentifier
bool$deleteRecursively
Returns
bool
Exceptions
Exception\FileOperationErrorException
Exception\InvalidPathException

Implements DriverInterface.

Definition at line 1166 of file LocalDriver.php.

References LocalDriver\getAbsolutePath(), and GeneralUtility\rmdir().

determineBaseUrl ( )
protected

Determines the base URL for this driver, from the configuration or the TypoScript frontend object

Returns
void

Definition at line 128 of file LocalDriver.php.

References ResourceStorageInterface\CAPABILITY_PUBLIC, elseif, AbstractDriver\hasCapability(), GeneralUtility\isFirstPartOfStr(), GeneralUtility\isValidUrl(), and PathUtility\stripPathSitePrefix().

Referenced by LocalDriver\processConfiguration().

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

Implements DriverInterface.

Definition at line 1376 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), and LocalDriver\getAbsolutePath().

extractFileInformation (   $filePath,
  $containerPath,
array  $propertiesToExtract = array() 
)
protected

Extracts information about a file from the filesystem.

Parameters
string$filePathThe absolute path to the file
string$containerPathThe relative path to the file's container
array$propertiesToExtractarray of properties which should be returned, if empty all will be extracted
Returns
array

Definition at line 646 of file LocalDriver.php.

Referenced by LocalDriver\getFileInfoByIdentifier().

fileExists (   $fileIdentifier)

Checks if a file exists.

Parameters
string$fileIdentifier
Returns
bool

Implements DriverInterface.

Definition at line 806 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

Referenced by LocalDriver\fileExistsInFolder(), and LocalDriver\renameFile().

fileExistsInFolder (   $fileName,
  $folderIdentifier 
)

Checks if a file inside a folder exists

Parameters
string$fileName
string$folderIdentifier
Returns
bool

Implements DriverInterface.

Definition at line 819 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), and LocalDriver\fileExists().

folderExists (   $folderIdentifier)

Checks if a folder exists.

Parameters
string$folderIdentifier
Returns
bool

Implements DriverInterface.

Definition at line 833 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

Referenced by LocalDriver\folderExistsInFolder(), LocalDriver\getDefaultFolder(), and LocalDriver\getFolderInfoByIdentifier().

folderExistsInFolder (   $folderName,
  $folderIdentifier 
)

Checks if a folder inside a folder exists.

Parameters
string$folderName
string$folderIdentifier
Returns
bool

Implements DriverInterface.

Definition at line 846 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), and LocalDriver\folderExists().

getAbsoluteBasePath ( )
protected

Returns the absolute path of the folder this driver operates on.

Returns
string

Definition at line 709 of file LocalDriver.php.

References LocalDriver\$absoluteBasePath.

Referenced by LocalDriver\sortDirectoryEntries().

getAbsolutePath (   $fileIdentifier)
protected
getCharsetConversion ( )
protected

Gets the charset conversion object.

Returns

Definition at line 1336 of file LocalDriver.php.

References LocalDriver\$charsetConversion, $GLOBALS, elseif, and GeneralUtility\makeInstance().

Referenced by LocalDriver\sanitizeFileName().

getDefaultFolder ( )

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

Returns
string

Implements DriverInterface.

Definition at line 215 of file LocalDriver.php.

References LocalDriver\createFolder(), and LocalDriver\folderExists().

getDirectoryItemList (   $folderIdentifier,
  $start = 0,
  $numberOfItems = 0,
array  $filterMethods,
  $includeFiles = true,
  $includeDirs = true,
  $recursive = false,
  $sort = '',
  $sortRev = false 
)
protected

Generic wrapper for extracting a list of items from a path.

Parameters
string$folderIdentifier
int$startThe position to start the listing; if not set, start from the beginning
int$numberOfItemsThe number of items to list; if set to zero, all items are returned
array$filterMethodsThe filter methods used to filter the directory items
bool$includeFiles
bool$includeDirs
bool$recursive
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
Exceptions
\InvalidArgumentException

Definition at line 363 of file LocalDriver.php.

References LocalDriver\applyFilterMethodsToDirectoryItem(), AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), LocalDriver\getAbsolutePath(), and AbstractHierarchicalFilesystemDriver\getParentFolderIdentifierOfIdentifier().

Referenced by LocalDriver\getFilesInFolder(), and LocalDriver\getFoldersInFolder().

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

Implements DriverInterface.

Definition at line 1303 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

getFileForLocalProcessing (   $fileIdentifier,
  $writable = true 
)

Returns (a local copy of) a file for processing it. This makes a copy first when in writable mode, so if you change the file, you have to update it yourself afterwards.

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

Implements DriverInterface.

Definition at line 1209 of file LocalDriver.php.

References LocalDriver\copyFileToTemporaryPath(), and LocalDriver\getAbsolutePath().

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

Returns information about a file.

Parameters
string$fileIdentifierIn the case of the LocalDriver, this is the (relative) path to the file.
array$propertiesToExtractArray of properties which should be extracted, if empty all will be extracted
Returns
array
Exceptions
\InvalidArgumentException

Implements DriverInterface.

Definition at line 260 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), PathUtility\dirname(), LocalDriver\extractFileInformation(), and LocalDriver\getAbsolutePath().

getFileInFolder (   $fileName,
  $folderIdentifier 
)

Returns a file inside the specified path

Parameters
string$fileName
string$folderIdentifier
Returns
string File Identifier

Implements DriverInterface.

Definition at line 449 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier().

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$filenameFilterCallbacksThe method callbacks to use 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

Implements DriverInterface.

Definition at line 470 of file LocalDriver.php.

References LocalDriver\getDirectoryItemList().

Referenced by LocalDriver\countFilesInFolder().

getFolderInfoByIdentifier (   $folderIdentifier)

Returns information about a folder.

Parameters
string$folderIdentifierIn the case of the LocalDriver, this is the (relative) path to the file.
Returns
array
Exceptions
Exception\FolderDoesNotExistException

Implements DriverInterface.

Definition at line 281 of file LocalDriver.php.

References PathUtility\basename(), AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), and LocalDriver\folderExists().

getFolderInFolder (   $folderName,
  $folderIdentifier 
)

Returns the Identifier for a folder within a given folder.

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

Implements DriverInterface.

Definition at line 860 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier().

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$folderNameFilterCallbacksThe method callbacks to use 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

Implements DriverInterface.

Definition at line 504 of file LocalDriver.php.

References LocalDriver\getDirectoryItemList().

Referenced by LocalDriver\countFoldersInFolder().

getPermissions (   $identifier)

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

Parameters
string$identifier
Returns
array
Exceptions
Exception\ResourcePermissionsUnavailableException

Implements DriverInterface.

Definition at line 1226 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

Referenced by LocalDriver\sortDirectoryEntries().

getPublicUrl (   $identifier)

Returns the public URL to a file. For the local driver, this will always return a path relative to PATH_site.

Parameters
string$identifier
Returns
string
Exceptions
\TYPO3\CMS\Core\Resource\Exception

Implements DriverInterface.

Definition at line 188 of file LocalDriver.php.

getRole (   $folderIdentifier)

Returns the role of an item (currently only folders; can later be extended for files as well)

Parameters
string$folderIdentifier
Returns
string

Definition at line 1358 of file LocalDriver.php.

References PathUtility\basename(), and FolderInterface\ROLE_DEFAULT.

getRootLevelFolder ( )

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

Returns
string

Implements DriverInterface.

Definition at line 205 of file LocalDriver.php.

hash (   $fileIdentifier,
  $hashAlgorithm 
)

Creates a (cryptographic) hash for a file.

Parameters
string$fileIdentifier
string$hashAlgorithmThe hash algorithm to use
Returns
string
Exceptions
\RuntimeException
\InvalidArgumentException

Implements DriverInterface.

Definition at line 737 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

initialize ( )

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

Returns
void

Implements DriverInterface.

Definition at line 118 of file LocalDriver.php.

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

Implements DriverInterface.

Definition at line 1185 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

isWithin (   $folderIdentifier,
  $identifier 
)

Checks if a given identifier is within a container, e.g. if a file or folder is within another folder. It will also return TRUE if both canonicalized identifiers are equal.

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

Implements DriverInterface.

Definition at line 1248 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), and GeneralUtility\isFirstPartOfStr().

mergeConfigurationCapabilities (   $capabilities)

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

Parameters
int$capabilities
Returns
int

Implements DriverInterface.

Definition at line 90 of file LocalDriver.php.

References AbstractDriver\$capabilities.

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
Exceptions
\RuntimeException

Implements DriverInterface.

Definition at line 918 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), and LocalDriver\getAbsolutePath().

moveFolderWithinStorage (   $sourceFolderIdentifier,
  $targetFolderIdentifier,
  $newFolderName 
)

Folder equivalent to moveFileWithinStorage().

Parameters
string$sourceFolderIdentifier
string$targetFolderIdentifier
string$newFolderName
Returns
array A map of old to new file identifiers
Exceptions
\RuntimeException

Implements DriverInterface.

Definition at line 1000 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), LocalDriver\createIdentifierMap(), and LocalDriver\getAbsolutePath().

processConfiguration ( )

Processes the configuration for this driver.

Returns
void

Implements DriverInterface.

Definition at line 102 of file LocalDriver.php.

References LocalDriver\calculateBasePath(), and LocalDriver\determineBaseUrl().

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
Exceptions
Exception\ExistingTargetFileNameException
\RuntimeException

Implements DriverInterface.

Definition at line 1075 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier(), PathUtility\dirname(), LocalDriver\fileExists(), GeneralUtility\fixWindowsFilePath(), LocalDriver\getAbsolutePath(), and LocalDriver\sanitizeFileName().

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 files and folders
Exceptions
\RuntimeExceptionif renaming the folder failed

Implements DriverInterface.

Definition at line 1106 of file LocalDriver.php.

References AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFolderIdentifier(), LocalDriver\createIdentifierMap(), PathUtility\dirname(), LocalDriver\getAbsolutePath(), and LocalDriver\sanitizeFileName().

replaceFile (   $fileIdentifier,
  $localFilePath 
)

Replaces the contents (and file-specific metadata) of a file object with a local file.

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

Implements DriverInterface.

Definition at line 874 of file LocalDriver.php.

References GeneralUtility\fixPermissions(), and LocalDriver\getAbsolutePath().

sanitizeFileName (   $fileName,
  $charset = '' 
)

Returns a string where any character not matching [.a-zA-Z0-9_-] is substituted by '_' Trailing dots are removed

Previously in ::cleanFileName()

Parameters
string$fileNameInput string, typically the body of a fileName
string$charsetCharset of the a fileName (defaults to current charset; depending on context)
Returns
string Output string with any characters not matching [.a-zA-Z0-9_-] is substituted by '_' and trailing dots removed
Exceptions
Exception\InvalidFileNameException

Implements DriverInterface.

Definition at line 310 of file LocalDriver.php.

References $GLOBALS, and LocalDriver\getCharsetConversion().

Referenced by LocalDriver\addFile(), LocalDriver\createFile(), LocalDriver\createFolder(), LocalDriver\renameFile(), and LocalDriver\renameFolder().

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
Exceptions
\RuntimeExceptionif the operation failed

Implements DriverInterface.

Definition at line 1317 of file LocalDriver.php.

References LocalDriver\getAbsolutePath().

sortDirectoryEntries (   $directoryEntries,
  $sort = '',
  $sortRev = false 
)
protected

Sort the directory entries by a certain key

Parameters
array$directoryEntriesArray of directory entry arrays from retrieveFileAndFoldersInPath()
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 Sorted entries. Content of the keys is undefined.

Definition at line 589 of file LocalDriver.php.

References LocalDriver\getAbsoluteBasePath(), and LocalDriver\getPermissions().

Member Data Documentation

$absoluteBasePath
protected
$baseUri = null
protected

Definition at line 55 of file LocalDriver.php.

$charsetConversion
protected

Definition at line 60 of file LocalDriver.php.

Referenced by LocalDriver\getCharsetConversion().

$mappingFolderNameToRole
protected
Initial value:
= array(
)

Definition at line 63 of file LocalDriver.php.

$supportedHashAlgorithms = array('sha1', 'md5')
protected

Definition at line 47 of file LocalDriver.php.

const UNSAFE_FILENAME_CHARACTER_EXPRESSION = '\\x00-\\x2C\\/\\x3A-\\x3F\\x5B-\\x60\\x7B-\\xBF'

Definition at line 33 of file LocalDriver.php.