‪TYPO3CMS  10.4
TYPO3\CMS\Core\Resource\Driver\AbstractDriver Class Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\Driver\AbstractDriver:
TYPO3\CMS\Core\Resource\Driver\DriverInterface TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver TYPO3\CMS\Core\Resource\Driver\LocalDriver

Public Member Functions

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

Protected Member Functions

bool isValidFilename ($fileName)
 
string getTemporaryPathForFile ($fileIdentifier)
 
string canonicalizeAndCheckFilePath ($filePath)
 
string canonicalizeAndCheckFileIdentifier ($fileIdentifier)
 
string canonicalizeAndCheckFolderIdentifier ($folderIdentifier)
 

Protected Attributes

int $capabilities = 0
 
int $storageUid
 
array $supportedHashAlgorithms = array( )
 
array $configuration = array( )
 

Detailed Description

An abstract implementation of a storage driver.

Definition at line 24 of file AbstractDriver.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Resource\Driver\AbstractDriver::__construct ( array  $configuration = [])

Creates this object.

Parameters
array$configuration

Reimplemented in TYPO3\CMS\Core\Resource\Driver\LocalDriver.

Definition at line 61 of file AbstractDriver.php.

References TYPO3\CMS\Core\Resource\Driver\AbstractDriver\$configuration.

Member Function Documentation

◆ canonicalizeAndCheckFileIdentifier()

string TYPO3\CMS\Core\Resource\Driver\AbstractDriver::canonicalizeAndCheckFileIdentifier (   $fileIdentifier)
abstractprotected

Makes sure the identifier given as parameter is valid

Parameters
string$fileIdentifier‪The file Identifier
Returns
‪string
Exceptions

Reimplemented in TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver.

Referenced by TYPO3\CMS\Core\Resource\Driver\AbstractDriver\hashIdentifier().

◆ canonicalizeAndCheckFilePath()

string TYPO3\CMS\Core\Resource\Driver\AbstractDriver::canonicalizeAndCheckFilePath (   $filePath)
abstractprotected

Makes sure the path given as parameter is valid

Parameters
string$filePath‪The file path (most times filePath)
Returns
‪string

Reimplemented in TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver.

◆ canonicalizeAndCheckFolderIdentifier()

string TYPO3\CMS\Core\Resource\Driver\AbstractDriver::canonicalizeAndCheckFolderIdentifier (   $folderIdentifier)
abstractprotected

Makes sure the identifier given as parameter is valid

Parameters
string$folderIdentifier‪The folder identifier
Returns
‪string

Reimplemented in TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver.

◆ getCapabilities()

int TYPO3\CMS\Core\Resource\Driver\AbstractDriver::getCapabilities ( )

Returns the capabilities of this driver.

Returns
‪int
See also
‪\TYPO3\CMS\Core\Resource\ResourceStorageInterface::CAPABILITY_BROWSABLE
‪\TYPO3\CMS\Core\Resource\ResourceStorageInterface::CAPABILITY_PUBLIC
‪\TYPO3\CMS\Core\Resource\ResourceStorageInterface::CAPABILITY_WRITABLE
‪\TYPO3\CMS\Core\Resource\ResourceStorageInterface::CAPABILITY_HIERARCHICAL_IDENTIFIERS

Implements TYPO3\CMS\Core\Resource\Driver\DriverInterface.

Definition at line 103 of file AbstractDriver.php.

References TYPO3\CMS\Core\Resource\Driver\AbstractDriver\$capabilities.

◆ getTemporaryPathForFile()

string TYPO3\CMS\Core\Resource\Driver\AbstractDriver::getTemporaryPathForFile (   $fileIdentifier)
protected

Returns a temporary path for a given file, including the file extension.

Parameters
string$fileIdentifier
Returns
‪string

Definition at line 129 of file AbstractDriver.php.

References TYPO3\CMS\Core\Utility\PathUtility\pathinfo().

Referenced by TYPO3\CMS\Core\Resource\Driver\LocalDriver\copyFileToTemporaryPath().

◆ hasCapability()

bool TYPO3\CMS\Core\Resource\Driver\AbstractDriver::hasCapability (   $capability)

Returns TRUE if this driver has the given capability.

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

Implements TYPO3\CMS\Core\Resource\Driver\DriverInterface.

Definition at line 114 of file AbstractDriver.php.

Referenced by TYPO3\CMS\Core\Resource\Driver\LocalDriver\determineBaseUrl().

◆ hashIdentifier()

string TYPO3\CMS\Core\Resource\Driver\AbstractDriver::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

Implements TYPO3\CMS\Core\Resource\Driver\DriverInterface.

Definition at line 142 of file AbstractDriver.php.

References TYPO3\CMS\Core\Resource\Driver\AbstractDriver\canonicalizeAndCheckFileIdentifier().

Referenced by TYPO3\CMS\Core\Resource\Driver\LocalDriver\getSpecificFileInformation().

◆ isCaseSensitiveFileSystem()

bool TYPO3\CMS\Core\Resource\Driver\AbstractDriver::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

Implements TYPO3\CMS\Core\Resource\Driver\DriverInterface.

Definition at line 170 of file AbstractDriver.php.

Referenced by TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver\canonicalizeAndCheckFileIdentifier().

◆ isValidFilename()

bool TYPO3\CMS\Core\Resource\Driver\AbstractDriver::isValidFilename (   $fileName)
protected

Checks a fileName for validity. This could be overridden in concrete drivers if they have different file naming rules.

Parameters
string$fileName
Returns
‪bool TRUE if file name is valid

Definition at line 73 of file AbstractDriver.php.

◆ sanitizeFileName()

string TYPO3\CMS\Core\Resource\Driver\AbstractDriver::sanitizeFileName (   $fileName,
  $charset = '' 
)

Basic implementation of the method that does directly return the file name as is.

Parameters
string$fileName‪Input 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

Implements TYPO3\CMS\Core\Resource\Driver\DriverInterface.

Reimplemented in TYPO3\CMS\Core\Resource\Driver\LocalDriver.

Definition at line 156 of file AbstractDriver.php.

◆ setStorageUid()

TYPO3\CMS\Core\Resource\Driver\AbstractDriver::setStorageUid (   $storageUid)

Sets the storage uid the driver belongs to

Parameters
int$storageUid

Implements TYPO3\CMS\Core\Resource\Driver\DriverInterface.

Definition at line 89 of file AbstractDriver.php.

References TYPO3\CMS\Core\Resource\Driver\AbstractDriver\$storageUid.

Member Data Documentation

◆ $capabilities

int TYPO3\CMS\Core\Resource\Driver\AbstractDriver::$capabilities = 0
protected

The capabilities of this driver. See \TYPO3\CMS\Core\Resource\ResourceStorageInterface::::CAPABILITY_* constants for possible values. This value should be set in the constructor of derived classes.

Definition at line 34 of file AbstractDriver.php.

Referenced by TYPO3\CMS\Core\Resource\Driver\AbstractDriver\getCapabilities(), and TYPO3\CMS\Core\Resource\Driver\LocalDriver\mergeConfigurationCapabilities().

◆ $configuration

array TYPO3\CMS\Core\Resource\Driver\AbstractDriver::$configuration = array( )
protected

◆ $storageUid

int TYPO3\CMS\Core\Resource\Driver\AbstractDriver::$storageUid
protected

◆ $supportedHashAlgorithms

array TYPO3\CMS\Core\Resource\Driver\AbstractDriver::$supportedHashAlgorithms = array( )
protected

A list of all supported hash algorithms, written all lower case and without any dashes etc. (e.g. sha1 instead of SHA-1) Be sure to set this in inherited classes!

Definition at line 48 of file AbstractDriver.php.