‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Resource\ResourceStorage Class Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\ResourceStorage:
TYPO3\CMS\Core\Resource\ResourceStorageInterface

Public Member Functions

 __construct (DriverInterface $driver, array $storageRecord, EventDispatcherInterface $eventDispatcher=null)
 
array getConfiguration ()
 
 setConfiguration (array $configuration)
 
array getStorageRecord ()
 
ResourceStorage setDriver (DriverInterface $driver)
 
string getName ()
 
int getUid ()
 
bool hasChildren ()
 
 getCapabilities ()
 
bool isPublic ()
 
bool isWritable ()
 
bool isBrowsable ()
 
 hasHierarchicalIdentifiers ()
 
 searchFiles (FileSearchDemand $searchDemand, Folder $folder=null, bool $useFilters=true)
 
bool usesCaseSensitiveIdentifiers ()
 
bool isOnline ()
 
bool autoExtractMetadataEnabled ()
 
 markAsPermanentlyOffline ()
 
 markAsTemporaryOffline ()
 
 addFileMount ($folderIdentifier, $additionalData=[])
 
array getFileMounts ()
 
bool isWithinFileMountBoundaries ($subject, $checkWriteAccess=false)
 
 setEvaluatePermissions ($evaluatePermissions)
 
bool getEvaluatePermissions ()
 
 setUserPermissions (array $userPermissions)
 
bool checkUserActionPermission ($action, $type)
 
bool checkFileActionPermission ($action, FileInterface $file)
 
bool checkFolderActionPermission ($action, Folder $folder=null)
 
string sanitizeFileName ($fileName, Folder $targetFolder=null)
 
FileInterface addFile ($localFilePath, Folder $targetFolder, $targetFileName='', $conflictMode=DuplicationBehavior::RENAME, $removeOriginal=true)
 
FileInterface updateProcessedFile ($localFilePath, ProcessedFile $processedFile, Folder $processingFolder=null)
 
string hashFile (FileInterface $fileObject, $hash)
 
string hashFileByIdentifier ($fileIdentifier, $hash)
 
string hashFileIdentifier ($file)
 
string null getPublicUrl (ResourceInterface $resourceObject)
 
 processFile (File|FileReference $fileObject, string $context, array $configuration)
 
string getFileForLocalProcessing (FileInterface $fileObject, $writable=true)
 
FileInterface getFile ($identifier)
 
File ProcessedFile null getFileByIdentifier (string $fileIdentifier)
 
array getFileInfo (FileInterface $fileObject)
 
array getFileInfoByIdentifier ($identifier, array $propertiesToExtract=[])
 
 unsetFileAndFolderNameFilters ()
 
 resetFileAndFolderNameFiltersToDefault ()
 
 addFileAndFolderNameFilter ($filter)
 
string getFolderIdentifierFromFileIdentifier ($fileIdentifier)
 
File ProcessedFile null getFileInFolder ($fileName, Folder $folder)
 
File[] getFilesInFolder (Folder $folder, $start=0, $maxNumberOfItems=0, $useFilters=true, $recursive=false, $sort='', $sortRev=false)
 
array getFileIdentifiersInFolder ($folderIdentifier, $useFilters=true, $recursive=false)
 
int countFilesInFolder (Folder $folder, $useFilters=true, $recursive=false)
 
array getFolderIdentifiersInFolder ($folderIdentifier, $useFilters=true, $recursive=false)
 
bool hasFile ($identifier)
 
Folder[] getProcessingFolders ()
 
bool isProcessingFolder (Folder $folder)
 
bool hasFileInFolder ($fileName, Folder $folder)
 
string getFileContents ($file)
 
 streamFile (FileInterface $file, bool $asDownload=false, string $alternativeFilename=null, string $overrideMimeType=null)
 
int setFileContents (AbstractFile $file, $contents)
 
FileInterface createFile ($fileName, Folder $targetFolderObject)
 
bool deleteFile ($fileObject)
 
FileInterface copyFile (FileInterface $file, Folder $targetFolder, $targetFileName=null, $conflictMode=DuplicationBehavior::RENAME)
 
FileInterface moveFile ($file, $targetFolder, $targetFileName=null, $conflictMode=DuplicationBehavior::RENAME)
 
FileInterface renameFile ($file, $targetFileName, $conflictMode=DuplicationBehavior::RENAME)
 
FileInterface replaceFile (FileInterface $file, $localFilePath)
 
FileInterface addUploadedFile (array|UploadedFile $uploadedFileData, Folder $targetFolder=null, $targetFileName=null, $conflictMode=DuplicationBehavior::CANCEL)
 
Folder moveFolder (Folder $folderToMove, Folder $targetParentFolder, $newFolderName=null, $conflictMode=DuplicationBehavior::RENAME)
 
Folder copyFolder (FolderInterface $folderToCopy, FolderInterface $targetParentFolder, $newFolderName=null, $conflictMode=DuplicationBehavior::RENAME)
 
Folder renameFolder ($folderObject, $newName)
 
bool deleteFolder ($folderObject, $deleteRecursively=false)
 
Folder InaccessibleFolder getFolderInFolder ($folderName, Folder $parentFolder, $returnInaccessibleFolderObject=false)
 
array< string|int, getFoldersInFolder(Folder $folder, $start=0, $maxNumberOfItems=0, $useFilters=true, $recursive=false, $sort='', $sortRev=false) { $filters=$useFilters==true ? $this-> getFileAndFolderNameFilters ()
 
int countFoldersInFolder (Folder $folder, $useFilters=true, $recursive=false)
 
bool hasFolder ($identifier)
 
bool hasFolderInFolder ($folderName, Folder $folder)
 
Folder createFolder ($folderName, Folder $parentFolder=null)
 
array getFolderInfo (Folder $folder)
 
Folder getDefaultFolder ()
 
Folder InaccessibleFolder getFolder ($identifier, $returnInaccessibleFolderObject=false)
 
bool isWithinProcessingFolder ($identifier)
 
bool isWithinFolder (Folder $folder, ResourceInterface $resource)
 
Folder getRootLevelFolder ($respectFileMounts=true)
 
string getRole (FolderInterface $folder)
 
Folder getProcessingFolder (File $file=null)
 
string getDriverType ()
 
 setDefault ($isDefault)
 
bool isDefault ()
 
 getResourceFactoryInstance ()
 

Public Attributes

const PROCESSING_FOLDER_LEVELS = 2
 
array< int, function getImportExportFilter():array { $filter=GeneralUtility::makeInstance(ImportExportFilter::class);return[ $filter, 'filterImportExportFilesAndFolders'];} public array function getFileAndFolderNameFilters() { return array_merge( $this->fileAndFolderNameFilters,[ $this->getImportExportFilter()]);} public $this function setFileAndFolderNameFilters(array $filters) { $this-> fileAndFolderNameFilters = $filters
 
return $this
 
 $folderIdentifiers = $this->driver->getFoldersInFolder($folder->getIdentifier(), $start, $maxNumberOfItems, $recursive, $filters, $sort, $sortRev)
 
foreach($this->getProcessingFolders() as $processingFolder) $folders = []
 
foreach($folderIdentifiers as $folderIdentifier) return $folders
 
- ‪Public Attributes inherited from ‪TYPO3\CMS\Core\Resource\ResourceStorageInterface
const DEFAULT_ProcessingFolder = '_processed_'
 

Protected Member Functions

Driver DriverInterface getDriver ()
 
 hasCapability (int $capability)
 
bool checkFileExtensionPermission ($fileName)
 
 assureFolderReadPermission (Folder $folder=null)
 
 assureFolderDeletePermission (Folder $folder, $checkDeleteRecursively)
 
 assureFileReadPermission (FileInterface $file)
 
 assureFileWritePermissions (FileInterface $file)
 
 assureFileReplacePermissions (FileInterface $file)
 
 assureFileDeletePermissions (FileInterface $file)
 
 assureFileAddPermissions ($targetFolder, $targetFileName)
 
 assureFileUploadPermissions ($localFilePath, $targetFolder, $targetFileName, $uploadedFileSize)
 
 assureFileMovePermissions (FileInterface $file, Folder $targetFolder, $targetFileName)
 
 assureFileRenamePermissions (FileInterface $file, $targetFileName)
 
 assureFileCopyPermissions (FileInterface $file, Folder $targetFolder, $targetFileName)
 
 assureFolderCopyPermissions (FolderInterface $folderToCopy, FolderInterface $targetParentFolder)
 
 assureFolderMovePermissions (FolderInterface $folderToMove, FolderInterface $targetParentFolder)
 
 getProcessedFileRepository ()
 
ResponseInterface getPseudoStream (FileInterface $file, bool $asDownload=false, string $alternativeFilename=null, string $overrideMimeType=null)
 
File[] getAllFileObjectsInFolder (Folder $folder)
 
 moveFolderBetweenStorages (Folder $folderToMove, Folder $targetParentFolder, $newFolderName)
 
 copyFolderBetweenStorages (FolderInterface $folderToCopy, FolderInterface $targetParentFolder, $newFolderName)
 
string getUniqueName (FolderInterface $folder, $theFile, $dontCheckForUnique=false)
 
ResourceFactory getFileFactory ()
 
Index FileIndexRepository getFileIndexRepository ()
 
Service FileProcessingService getFileProcessingService ()
 
Folder getNestedProcessingFolder (File $file, Folder $rootProcessingFolder)
 
string[] getNamesForNestedProcessingFolder ($fileIdentifier, $levels)
 
Index Indexer getIndexer ()
 
 getBackendUser ()
 
Folder null getNearestRecyclerFolder (FileInterface $file)
 
Folder createFolderObject (string $identifier, string $name)
 

Protected Attributes

Driver DriverInterface $driver
 
array $storageRecord
 
array $configuration
 
Service FileProcessingService $fileProcessingService
 
bool $evaluatePermissions = false
 
array $fileMounts = array( )
 
array $userPermissions = array( )
 
Capabilities $capabilities
 
EventDispatcherInterface $eventDispatcher
 
Folder null $processingFolder
 
Folder[] $processingFolders
 
bool $isOnline
 
bool $isDefault = false
 
array $fileAndFolderNameFilters = array( )
 

Detailed Description

A "mount point" inside the TYPO3 file handling.

A "storage" object handles

  • ‪abstraction to the driver
  • ‪permissions (from the driver, and from the user, + capabilities)
  • ‪an entry point for files, folders, and for most other operations

== Driver entry point The driver itself, that does the actual work on the file system, is inside the storage but completely shadowed by the storage, as the storage also handles the abstraction to the driver

The storage can be on the local system, but can also be on a remote system. The combination of driver + configurable capabilities (storage is read-only e.g.) allows for flexible uses.

== Permission system As all requests have to run through the storage, the storage knows about the permissions of a BE/FE user, the file permissions / limitations of the driver and has some configurable capabilities. Additionally, a BE user can use "filemounts" (known from previous installations) to limit his/her work-zone to only a subset (identifier and its subfolders/subfolders) of the user itself.

Check 1: "User Permissions" [is the user allowed to write a file) [is the user allowed to write a file] Check 2: "File Mounts" of the User (act as subsets / filters to the identifiers) [is the user allowed to do something in this folder?] Check 3: "Capabilities" of Storage (then: of Driver) [is the storage/driver writable?] Check 4: "File permissions" of the Driver [is the folder writable?]

Definition at line 126 of file ResourceStorage.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ addFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::addFile (   $localFilePath,
Folder  $targetFolder,
  $targetFileName = '',
  $conflictMode = DuplicationBehavior::RENAME,
  $removeOriginal = true 
)

◆ addFileAndFolderNameFilter()

TYPO3\CMS\Core\Resource\ResourceStorage::addFileAndFolderNameFilter (   $filter)
Parameters
callable$filter

Definition at line 1508 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\fileAndFolderNameFilters.

◆ addFileMount()

TYPO3\CMS\Core\Resource\ResourceStorage::addFileMount (   $folderIdentifier,
  $additionalData = [] 
)

Adds a filemount as a "filter" for users to only work on a subset of a storage object

Parameters
string$folderIdentifier
array$additionalData
Exceptions
Exception

Definition at line 542 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\createFolderObject().

Referenced by TYPO3\CMS\Core\Resource\Security\StoragePermissionsAspect\addFileMountsToStorage().

◆ addUploadedFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::addUploadedFile ( array|UploadedFile  $uploadedFileData,
Folder  $targetFolder = null,
  $targetFileName = null,
  $conflictMode = DuplicationBehavior::CANCEL 
)

Adds an uploaded file into the Storage. Previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::file_upload()

Parameters
array | UploadedFile$uploadedFileData‪contains information about the uploaded file given by $_FILES['file1']
Folder | null$targetFolder‪the target folder
string | null$targetFileName‪the file name to be written
string$conflictMode‪a value of the DuplicationBehavior enumeration
Returns
FileInterface The file object

Definition at line 2082 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\addFile(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileUploadPermissions(), TYPO3\CMS\Core\Type\Enumeration\cast(), TYPO3\CMS\Core\Http\UploadedFile\getClientFilename(), TYPO3\CMS\Core\Resource\ResourceStorage\getDefaultFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileInFolder(), TYPO3\CMS\Core\Http\UploadedFile\getSize(), TYPO3\CMS\Core\Http\UploadedFile\getTemporaryFileName(), TYPO3\CMS\Core\Resource\ResourceStorage\hasFileInFolder(), TYPO3\CMS\Core\Resource\DuplicationBehavior\REPLACE, and TYPO3\CMS\Core\Resource\ResourceStorage\replaceFile().

◆ assureFileAddPermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFileAddPermissions (   $targetFolder,
  $targetFileName 
)
protected

Checks if a file/user has the permission to be written to a Folder/Storage. If not, throws an exception.

Parameters
Folder$targetFolder‪The target folder where the file should be written
string$targetFileName‪The file name which should be written into the storage
Exceptions
Exception

Definition at line 974 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\checkFileExtensionPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\checkFolderActionPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\checkUserActionPermission(), and TYPO3\CMS\Core\Resource\ResourceStorage\getUid().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addFile(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileUploadPermissions(), and TYPO3\CMS\Core\Resource\ResourceStorage\createFile().

◆ assureFileCopyPermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFileCopyPermissions ( FileInterface  $file,
Folder  $targetFolder,
  $targetFileName 
)
protected

◆ assureFileDeletePermissions()

◆ assureFileMovePermissions()

◆ assureFileReadPermission()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFileReadPermission ( FileInterface  $file)
protected

◆ assureFileRenamePermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFileRenamePermissions ( FileInterface  $file,
  $targetFileName 
)
protected

◆ assureFileReplacePermissions()

◆ assureFileUploadPermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFileUploadPermissions (   $localFilePath,
  $targetFolder,
  $targetFileName,
  $uploadedFileSize 
)
protected

Checks if a file has the permission to be uploaded to a Folder/Storage. If not, throws an exception.

Parameters
string$localFilePath‪the temporary file name from $_FILES['file1']['tmp_name']
Folder$targetFolder‪The target folder where the file should be uploaded
string$targetFileName‪the destination file name $_FILES['file1']['name']
int$uploadedFileSize
Exceptions
Exception

Definition at line 1005 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\assureFileAddPermissions().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addUploadedFile().

◆ assureFileWritePermissions()

◆ assureFolderCopyPermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFolderCopyPermissions ( FolderInterface  $folderToCopy,
FolderInterface  $targetParentFolder 
)
protected

◆ assureFolderDeletePermission()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFolderDeletePermission ( Folder  $folder,
  $checkDeleteRecursively 
)
protected

Assures delete permission for given folder.

Parameters
Folder$folder‪If a folder is given, mountpoints are checked. If not only user folder delete permissions are checked.
bool$checkDeleteRecursively
Exceptions
Exception

Definition at line 851 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\checkFolderActionPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\checkUserActionPermission(), and TYPO3\CMS\Core\Resource\Folder\getName().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\deleteFolder().

◆ assureFolderMovePermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::assureFolderMovePermissions ( FolderInterface  $folderToMove,
FolderInterface  $targetParentFolder 
)
protected

◆ assureFolderReadPermission()

◆ autoExtractMetadataEnabled()

bool TYPO3\CMS\Core\Resource\ResourceStorage::autoExtractMetadataEnabled ( )

Returns TRUE if auto extracting of metadata is enabled

Returns
‪bool

Definition at line 488 of file ResourceStorage.php.

◆ checkFileActionPermission()

bool TYPO3\CMS\Core\Resource\ResourceStorage::checkFileActionPermission (   $action,
FileInterface  $file 
)

Checks if a file operation (= action) is allowed on a File/Folder/Storage (= subject).

This method, by design, does not throw exceptions or do logging. Besides the usage from other methods in this class, it is also used by the Filelist UI to check whether an action is allowed and whether action related UI elements should thus be shown (move icon, edit icon, etc.)

Parameters
string$action‪action, can be read, write, delete, editMeta
FileInterface$file
Returns
‪bool

Definition at line 696 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\checkFileExtensionPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\checkUserActionPermission(), TYPO3\CMS\Core\Resource\ResourceInterface\getIdentifier(), TYPO3\CMS\Core\Resource\ResourceInterface\getName(), TYPO3\CMS\Core\Resource\ResourceStorage\isWithinFileMountBoundaries(), and TYPO3\CMS\Core\Resource\ResourceStorage\isWritable().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\assureFileDeletePermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileReadPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileRenamePermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileReplacePermissions(), and TYPO3\CMS\Core\Resource\ResourceStorage\assureFileWritePermissions().

◆ checkFileExtensionPermission()

bool TYPO3\CMS\Core\Resource\ResourceStorage::checkFileExtensionPermission (   $fileName)
protected

◆ checkFolderActionPermission()

◆ checkUserActionPermission()

bool TYPO3\CMS\Core\Resource\ResourceStorage::checkUserActionPermission (   $action,
  $type 
)

◆ copyFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::copyFile ( FileInterface  $file,
Folder  $targetFolder,
  $targetFileName = null,
  $conflictMode = DuplicationBehavior::RENAME 
)

Previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::func_copy() copies a source file (from any location) in to the target folder, the latter has to be part of this storage

Parameters
string$targetFileName‪an optional destination fileName
string$conflictMode‪a value of the DuplicationBehavior enumeration
Exceptions

Definition at line 1872 of file ResourceStorage.php.

◆ copyFolder()

◆ copyFolderBetweenStorages()

TYPO3\CMS\Core\Resource\ResourceStorage::copyFolderBetweenStorages ( FolderInterface  $folderToCopy,
FolderInterface  $targetParentFolder,
  $newFolderName 
)
protected

Copies a folder between storages.

Parameters
string$newFolderName
Exceptions
NotImplementedMethodException

Definition at line 2264 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\copyFolder().

◆ countFilesInFolder()

int TYPO3\CMS\Core\Resource\ResourceStorage::countFilesInFolder ( Folder  $folder,
  $useFilters = true,
  $recursive = false 
)
Parameters
bool$useFilters
bool$recursive
Returns
‪int Number of files in folder
Exceptions
Exception

Definition at line 1595 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderReadPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileAndFolderNameFilters(), and TYPO3\CMS\Core\Resource\Folder\getIdentifier().

◆ countFoldersInFolder()

int TYPO3\CMS\Core\Resource\ResourceStorage::countFoldersInFolder ( Folder  $folder,
  $useFilters = true,
  $recursive = false 
)

◆ createFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::createFile (   $fileName,
Folder  $targetFolderObject 
)

Creates a new file

previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::func_newfile()

Parameters
string$fileName‪The name of the file to be created
Folder$targetFolderObject‪The target folder where the file should be created
Exceptions
Exception

Definition at line 1799 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\assureFileAddPermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileByIdentifier(), and TYPO3\CMS\Core\Resource\Folder\getIdentifier().

◆ createFolder()

Folder TYPO3\CMS\Core\Resource\ResourceStorage::createFolder (   $folderName,
Folder  $parentFolder = null 
)

Creates a new folder.

previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::func_newfolder()

Parameters
string$folderName‪The new folder name
Folder$parentFolder‪(optional) the parent folder to create the new folder inside of. If not given, the root folder is used
Returns
Folder
Exceptions
Exception

Definition at line 2445 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\checkFolderActionPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\getDriver(), TYPO3\CMS\Core\Resource\ResourceStorage\getFolder(), and TYPO3\CMS\Core\Resource\ResourceStorage\getRootLevelFolder().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolder().

◆ createFolderObject()

Folder TYPO3\CMS\Core\Resource\ResourceStorage::createFolderObject ( string  $identifier,
string  $name 
)
protected

Creates a folder to directly access (a part of) a storage.

Parameters
string$identifier‪The path to the folder. Might also be a simple unique string, depending on the storage driver.
string$name‪The name of the folder (e.g. the folder name)
Returns
Folder

Definition at line 2913 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$identifier, and TYPO3\CMS\Core\Resource\ResourceStorage\$this.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addFileMount(), TYPO3\CMS\Core\Resource\ResourceStorage\getFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolders(), and TYPO3\CMS\Core\Resource\ResourceStorage\getRootLevelFolder().

◆ deleteFile()

bool TYPO3\CMS\Core\Resource\ResourceStorage::deleteFile (   $fileObject)

◆ deleteFolder()

bool TYPO3\CMS\Core\Resource\ResourceStorage::deleteFolder (   $folderObject,
  $deleteRecursively = false 
)

Previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::folder_delete()

Parameters
Folder$folderObject
bool$deleteRecursively
Exceptions

Definition at line 2321 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderDeletePermission(), TYPO3\CMS\Core\Resource\ResourceStorage\deleteFile(), and TYPO3\CMS\Core\Resource\ResourceStorage\getFilesInFolder().

◆ getAllFileObjectsInFolder()

File [] TYPO3\CMS\Core\Resource\ResourceStorage::getAllFileObjectsInFolder ( Folder  $folder)
protected

Returns an array with all file objects in a folder and its subfolders, with the file identifiers as keys.

Todo:
‪check if this is a duplicate
Returns
File[]

Definition at line 2122 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\Folder\getFiles(), and TYPO3\CMS\Core\Resource\Folder\getSubfolders().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\moveFolder(), and TYPO3\CMS\Core\Resource\ResourceStorage\renameFolder().

◆ getBackendUser()

TYPO3\CMS\Core\Resource\ResourceStorage::getBackendUser ( )
protected

Definition at line 2857 of file ResourceStorage.php.

References $GLOBALS.

◆ getCapabilities()

TYPO3\CMS\Core\Resource\ResourceStorage::getCapabilities ( )

Returns the capabilities of this storage.

Definition at line 357 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$capabilities.

◆ getConfiguration()

array TYPO3\CMS\Core\Resource\ResourceStorage::getConfiguration ( )

◆ getDefaultFolder()

Folder TYPO3\CMS\Core\Resource\ResourceStorage::getDefaultFolder ( )

Returns the default folder where new files are stored if no other folder is given.

Returns
Folder

Definition at line 2488 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\getFolder().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addUploadedFile(), and TYPO3\CMS\Core\Resource\ResourceStorage\sanitizeFileName().

◆ getDriver()

Driver DriverInterface TYPO3\CMS\Core\Resource\ResourceStorage::getDriver ( )
protected

Returns the driver object belonging to this storage.

Returns
Driver\DriverInterface

Definition at line 316 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$driver.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\createFolder().

◆ getDriverType()

string TYPO3\CMS\Core\Resource\ResourceStorage::getDriverType ( )

Gets the driver Type configured for this storage.

Returns
‪string

Definition at line 2821 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Impexp\Import\isEquivalentStorage().

◆ getEvaluatePermissions()

bool TYPO3\CMS\Core\Resource\ResourceStorage::getEvaluatePermissions ( )

Gets whether the permissions to access or write into this storage should be checked or not.

Returns
‪bool $evaluatePermissions

Definition at line 649 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$evaluatePermissions.

◆ getFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::getFile (   $identifier)

Gets a file by identifier.

Parameters
string$identifier
Returns
FileInterface

Definition at line 1401 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$identifier, and TYPO3\CMS\Core\Resource\ResourceStorage\getFileByIdentifier().

◆ getFileAndFolderNameFilters()

array<string|int, getFoldersInFolder(Folder $folder, $start = 0, $maxNumberOfItems = 0, $useFilters = true, $recursive = false, $sort = '', $sortRev = false) { $filters = $useFilters == true ? $this-> TYPO3\CMS\Core\Resource\ResourceStorage::getFileAndFolderNameFilters ( )
Parameters
int$start
int$maxNumberOfItems
bool$useFilters
bool$recursive
string$sort‪Property 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$sortRev‪TRUE to indicate reverse sorting (last to first)
Returns
‪array<string|int, Folder>

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\countFilesInFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\countFoldersInFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileIdentifiersInFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\getFilesInFolder(), and TYPO3\CMS\Core\Resource\ResourceStorage\getFolderIdentifiersInFolder().

◆ getFileByIdentifier()

◆ getFileContents()

string TYPO3\CMS\Core\Resource\ResourceStorage::getFileContents (   $file)

Get contents of a file object

Parameters
FileInterface$file
Exceptions
Exception

Definition at line 1696 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\assureFileReadPermission().

◆ getFileFactory()

ResourceFactory TYPO3\CMS\Core\Resource\ResourceStorage::getFileFactory ( )
protected

◆ getFileForLocalProcessing()

string TYPO3\CMS\Core\Resource\ResourceStorage::getFileForLocalProcessing ( FileInterface  $fileObject,
  $writable = true 
)

Copies a file from the storage for local processing.

Parameters
bool$writable
Returns
‪string Path to local file (either original or copied to some temporary local location)

Definition at line 1389 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceInterface\getIdentifier().

◆ getFileIdentifiersInFolder()

array TYPO3\CMS\Core\Resource\ResourceStorage::getFileIdentifiersInFolder (   $folderIdentifier,
  $useFilters = true,
  $recursive = false 
)
Parameters
string$folderIdentifier
bool$useFilters
bool$recursive
Returns
‪array

Definition at line 1583 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\getFileAndFolderNameFilters().

◆ getFileIndexRepository()

Index FileIndexRepository TYPO3\CMS\Core\Resource\ResourceStorage::getFileIndexRepository ( )
protected

◆ getFileInfo()

array TYPO3\CMS\Core\Resource\ResourceStorage::getFileInfo ( FileInterface  $fileObject)

◆ getFileInfoByIdentifier()

array TYPO3\CMS\Core\Resource\ResourceStorage::getFileInfoByIdentifier (   $identifier,
array  $propertiesToExtract = [] 
)

Gets information about a file by its identifier.

Parameters
string$identifier
Returns
‪array

Definition at line 1452 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$identifier.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getFileInfo().

◆ getFileInFolder()

File ProcessedFile null TYPO3\CMS\Core\Resource\ResourceStorage::getFileInFolder (   $fileName,
Folder  $folder 
)

Get file from folder

Parameters
string$fileName
Returns
‪File|ProcessedFile|null

Definition at line 1529 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$identifier, TYPO3\CMS\Core\Resource\ResourceStorage\getFileByIdentifier(), and TYPO3\CMS\Core\Resource\Folder\getIdentifier().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addUploadedFile().

◆ getFileMounts()

array TYPO3\CMS\Core\Resource\ResourceStorage::getFileMounts ( )

Returns all file mounts that are registered with this storage.

Returns
‪array

Definition at line 582 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$fileMounts.

Referenced by TYPO3\CMS\Backend\Tree\FileStorageTreeProvider\getMountsInStorage().

◆ getFileProcessingService()

Service FileProcessingService TYPO3\CMS\Core\Resource\ResourceStorage::getFileProcessingService ( )
protected

◆ getFilesInFolder()

File [] TYPO3\CMS\Core\Resource\ResourceStorage::getFilesInFolder ( Folder  $folder,
  $start = 0,
  $maxNumberOfItems = 0,
  $useFilters = true,
  $recursive = false,
  $sort = '',
  $sortRev = false 
)
Parameters
int$start
int$maxNumberOfItems
bool$useFilters
bool$recursive
string$sort‪Property 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$sortRev‪TRUE to indicate reverse sorting (last to first)
Returns
File[]
Exceptions
Exception

Definition at line 1549 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$identifier, TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderReadPermission(), TYPO3\CMS\Core\Resource\Index\FileIndexRepository\findByFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileAndFolderNameFilters(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileByIdentifier(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileFactory(), TYPO3\CMS\Core\Resource\ResourceStorage\getFileIndexRepository(), TYPO3\CMS\Core\Resource\ResourceFactory\getFileObject(), and TYPO3\CMS\Core\Resource\Folder\getIdentifier().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\deleteFolder().

◆ getFolder()

◆ getFolderIdentifierFromFileIdentifier()

string TYPO3\CMS\Core\Resource\ResourceStorage::getFolderIdentifierFromFileIdentifier (   $fileIdentifier)
Parameters
string$fileIdentifier
Returns
‪string

Definition at line 1518 of file ResourceStorage.php.

◆ getFolderIdentifiersInFolder()

array TYPO3\CMS\Core\Resource\ResourceStorage::getFolderIdentifiersInFolder (   $folderIdentifier,
  $useFilters = true,
  $recursive = false 
)
Parameters
string$folderIdentifier
bool$useFilters
bool$recursive
Returns
‪array

Definition at line 1608 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\getFileAndFolderNameFilters().

◆ getFolderInfo()

array TYPO3\CMS\Core\Resource\ResourceStorage::getFolderInfo ( Folder  $folder)

Retrieves information about a folder

Returns
‪array

Definition at line 2478 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\Folder\getIdentifier().

◆ getFolderInFolder()

Folder InaccessibleFolder TYPO3\CMS\Core\Resource\ResourceStorage::getFolderInFolder (   $folderName,
Folder  $parentFolder,
  $returnInaccessibleFolderObject = false 
)

Returns the Identifier for a folder within a given folder.

Parameters
string$folderName‪The name of the target folder
bool$returnInaccessibleFolderObject
Returns
‪Folder|InaccessibleFolder
Exceptions

Definition at line 2354 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\getFolder(), and TYPO3\CMS\Core\Resource\Folder\getIdentifier().

◆ getIndexer()

◆ getName()

string TYPO3\CMS\Core\Resource\ResourceStorage::getName ( )

Returns the name of this storage.

Returns
‪string

Definition at line 326 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\__construct(), and TYPO3\CMS\Backend\Tree\FileStorageTreeProvider\getMountsInStorage().

◆ getNamesForNestedProcessingFolder()

string [] TYPO3\CMS\Core\Resource\ResourceStorage::getNamesForNestedProcessingFolder (   $fileIdentifier,
  $levels 
)
protected

Generates appropriate hashed sub-folder path for a given file identifier

Parameters
string$fileIdentifier
int$levels
Returns
‪string[]

Definition at line 2803 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getNestedProcessingFolder().

◆ getNearestRecyclerFolder()

Folder null TYPO3\CMS\Core\Resource\ResourceStorage::getNearestRecyclerFolder ( FileInterface  $file)
protected

Get the nearest Recycler folder for given file

Return null if:

  • ‪There is no folder with ROLE_RECYCLER in the rootline of the given File
  • File is a ProcessedFile (we don't know the concept of recycler folders for processedFiles)
  • File is located in a folder with ROLE_RECYCLER
Parameters
FileInterface$file
Returns
‪Folder|null

Definition at line 2873 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\Folder\getIdentifier(), TYPO3\CMS\Core\Resource\ResourceInterface\getParentFolder(), TYPO3\CMS\Core\Resource\Folder\getParentFolder(), TYPO3\CMS\Core\Resource\Folder\getRole(), TYPO3\CMS\Core\Resource\Folder\getSubfolders(), TYPO3\CMS\Core\Resource\ResourceStorage\isBrowsable(), and TYPO3\CMS\Core\Resource\FolderInterface\ROLE_RECYCLER.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\deleteFile().

◆ getNestedProcessingFolder()

◆ getProcessedFileRepository()

TYPO3\CMS\Core\Resource\ResourceStorage::getProcessedFileRepository ( )
protected

◆ getProcessingFolder()

◆ getProcessingFolders()

◆ getPseudoStream()

ResponseInterface TYPO3\CMS\Core\Resource\ResourceStorage::getPseudoStream ( FileInterface  $file,
bool  $asDownload = false,
string  $alternativeFilename = null,
string  $overrideMimeType = null 
)
protected

Wrap DriverInterface::dumpFileContents into a SelfEmittableStreamInterface

Parameters
bool$asDownload‪If set Content-Disposition attachment is sent, inline otherwise
string$alternativeFilename‪the filename for the download (if $asDownload is set)
string$overrideMimeType‪If set this will be used as Content-Type header instead of the automatically detected mime type.
Returns
‪ResponseInterface

Definition at line 1735 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$this, TYPO3\CMS\Core\Resource\ResourceInterface\getIdentifier(), and TYPO3\CMS\Core\Resource\ResourceInterface\getName().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\streamFile().

◆ getPublicUrl()

string null TYPO3\CMS\Core\Resource\ResourceStorage::getPublicUrl ( ResourceInterface  $resourceObject)

Returns a publicly accessible URL for a file.

WARNING: Access to the file may be restricted by further means, e.g. some web-based authentication. You have to take care of this yourself.

Parameters
ResourceInterface$resourceObject‪The file or folder object
Returns
‪string|null NULL if file is missing or deleted, the generated url otherwise

Definition at line 1332 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$publicUrl, TYPO3\CMS\Core\Resource\ResourceStorage\$this, TYPO3\CMS\Core\Resource\Capabilities\CAPABILITY_PUBLIC, TYPO3\CMS\Core\Utility\PathUtility\getAbsoluteWebPath(), TYPO3\CMS\Core\Resource\ResourceInterface\getIdentifier(), TYPO3\CMS\Core\Core\Environment\getPublicPath(), TYPO3\CMS\Core\Resource\ResourceStorage\hasCapability(), TYPO3\CMS\Core\Utility\GeneralUtility\hmac(), and TYPO3\CMS\Core\Resource\ResourceStorage\isOnline().

◆ getResourceFactoryInstance()

TYPO3\CMS\Core\Resource\ResourceStorage::getResourceFactoryInstance ( )

◆ getRole()

◆ getRootLevelFolder()

Folder TYPO3\CMS\Core\Resource\ResourceStorage::getRootLevelFolder (   $respectFileMounts = true)

Returns the folders on the root level of the storage or the first mount point of this storage for this user if $respectFileMounts is set.

Parameters
bool$respectFileMounts
Returns
Folder
Todo:
‪: this is a bad method design, because the calling code can never fetch all filemounts nor traverse them.

Definition at line 2574 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\createFolderObject().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\createFolder(), TYPO3\CMS\Backend\Tree\FileStorageTreeProvider\getMountsInStorage(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\isWithinFileMountBoundaries(), and TYPO3\CMS\Core\Resource\ResourceStorage\searchFiles().

◆ getStorageRecord()

array TYPO3\CMS\Core\Resource\ResourceStorage::getStorageRecord ( )

Gets the storage record.

Returns
‪array

Definition at line 295 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$storageRecord.

◆ getUid()

int TYPO3\CMS\Core\Resource\ResourceStorage::getUid ( )

Returns the UID of this storage.

Returns
‪int

Definition at line 336 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\__construct(), TYPO3\CMS\Core\Resource\Security\StoragePermissionsAspect\addFileMountsToStorage(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileAddPermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileCopyPermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFileMovePermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderCopyPermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderMovePermissions(), TYPO3\CMS\Core\Resource\ProcessedFileRepository\countByStorage(), TYPO3\CMS\Core\Resource\ProcessedFileRepository\findByStorageAndIdentifier(), TYPO3\CMS\Core\Resource\Index\FileIndexRepository\findInStorageAndNotInUidList(), TYPO3\CMS\Core\Resource\Index\FileIndexRepository\findInStorageWithIndexOutstanding(), TYPO3\CMS\Core\Resource\Index\FileIndexRepository\findOneByStorageAndIdentifier(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFilePermissionsForStorage(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolders(), TYPO3\CMS\Install\Service\Typo3tempFileService\getStatsFromStorage(), TYPO3\CMS\Core\Resource\ResourceStorage\isOnline(), TYPO3\CMS\Core\Resource\ResourceStorage\markAsPermanentlyOffline(), TYPO3\CMS\Core\Resource\ResourceStorage\markAsTemporaryOffline(), TYPO3\CMS\Core\Resource\ResourceStorage\moveFile(), TYPO3\CMS\Core\Resource\ResourceStorage\moveFolder(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\removeItemsByUserStorageRestriction(), and TYPO3\CMS\Core\Resource\AbstractFile\setStorage().

◆ getUniqueName()

string TYPO3\CMS\Core\Resource\ResourceStorage::getUniqueName ( FolderInterface  $folder,
  $theFile,
  $dontCheckForUnique = false 
)
protected

Returns the destination path/fileName of a unique fileName/foldername in that path. If $theFile exists in $theDest (directory) the file have numbers appended up to $this->maxNumber. Hereafter a unique string will be appended. This function is used by fx. DataHandler when files are attached to records and needs to be uniquely named in the uploads/* folders

Parameters
string$theFile‪The input fileName to check
bool$dontCheckForUnique‪If set the fileName is returned with the path prepended without checking whether it already existed!
Exceptions

Definition at line 2597 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$this, TYPO3\CMS\Core\Resource\ResourceInterface\getIdentifier(), TYPO3\CMS\Core\Utility\StringUtility\getUniqueId(), and TYPO3\CMS\Core\Utility\PathUtility\pathinfo().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addFile(), TYPO3\CMS\Core\Resource\ResourceStorage\copyFolder(), TYPO3\CMS\Core\Resource\ResourceStorage\moveFile(), and TYPO3\CMS\Core\Resource\ResourceStorage\renameFile().

◆ hasCapability()

TYPO3\CMS\Core\Resource\ResourceStorage::hasCapability ( int  $capability)
protected

◆ hasChildren()

bool TYPO3\CMS\Core\Resource\ResourceStorage::hasChildren ( )

Tells whether there are children in this storage.

Returns
‪bool

Definition at line 346 of file ResourceStorage.php.

◆ hasFile()

bool TYPO3\CMS\Core\Resource\ResourceStorage::hasFile (   $identifier)

◆ hasFileInFolder()

bool TYPO3\CMS\Core\Resource\ResourceStorage::hasFileInFolder (   $fileName,
Folder  $folder 
)

Checks if the queried file in the given folder exists

Parameters
string$fileName
Returns
‪bool

Definition at line 1682 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderReadPermission(), and TYPO3\CMS\Core\Resource\Folder\getIdentifier().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addUploadedFile().

◆ hasFolder()

bool TYPO3\CMS\Core\Resource\ResourceStorage::hasFolder (   $identifier)

Returns TRUE if the specified folder exists.

Parameters
string$identifier
Returns
‪bool

Definition at line 2414 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$identifier, and TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderReadPermission().

◆ hasFolderInFolder()

bool TYPO3\CMS\Core\Resource\ResourceStorage::hasFolderInFolder (   $folderName,
Folder  $folder 
)

Checks if the given file exists in the given folder

Parameters
string$folderName
Returns
‪bool

Definition at line 2426 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\assureFolderReadPermission(), and TYPO3\CMS\Core\Resource\Folder\getIdentifier().

◆ hashFile()

string TYPO3\CMS\Core\Resource\ResourceStorage::hashFile ( FileInterface  $fileObject,
  $hash 
)

Creates a (cryptographic) hash for a file.

Parameters
string$hash
Exceptions

Definition at line 1284 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceInterface\getIdentifier(), and TYPO3\CMS\Core\Resource\ResourceStorage\hashFileByIdentifier().

◆ hashFileByIdentifier()

string TYPO3\CMS\Core\Resource\ResourceStorage::hashFileByIdentifier (   $fileIdentifier,
  $hash 
)

Creates a (cryptographic) hash for a fileIdentifier.

Parameters
string$fileIdentifier
string$hash
Exceptions

Definition at line 1297 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\hashFile().

◆ hashFileIdentifier()

string TYPO3\CMS\Core\Resource\ResourceStorage::hashFileIdentifier (   $file)

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

Parameters
string | FileInterface$file
Returns
‪string

Definition at line 1314 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\Index\FileIndexRepository\findOneByStorageAndIdentifier().

◆ hasHierarchicalIdentifiers()

TYPO3\CMS\Core\Resource\ResourceStorage::hasHierarchicalIdentifiers ( )

Returns TRUE if this storage stores folder structure in file identifiers.

Definition at line 409 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\Capabilities\CAPABILITY_HIERARCHICAL_IDENTIFIERS, and TYPO3\CMS\Core\Resource\ResourceStorage\hasCapability().

◆ isBrowsable()

◆ isDefault()

bool TYPO3\CMS\Core\Resource\ResourceStorage::isDefault ( )

◆ isOnline()

◆ isProcessingFolder()

bool TYPO3\CMS\Core\Resource\ResourceStorage::isProcessingFolder ( Folder  $folder)

Returns TRUE if folder that is in current storage is set as processing folder for one of the existing storages

Returns
‪bool

Definition at line 1664 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$processingFolder, TYPO3\CMS\Core\Resource\Folder\getCombinedIdentifier(), and TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolders().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getRole().

◆ isPublic()

bool TYPO3\CMS\Core\Resource\ResourceStorage::isPublic ( )

Returns TRUE if this storage is publicly available. This is just a configuration option and does not mean that it really is public. OTOH a storage that is marked as not publicly available will trigger the file publishing mechanisms of TYPO3.

Returns
‪bool

Definition at line 380 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\Capabilities\CAPABILITY_PUBLIC, and TYPO3\CMS\Core\Resource\ResourceStorage\hasCapability().

◆ isWithinFileMountBoundaries()

bool TYPO3\CMS\Core\Resource\ResourceStorage::isWithinFileMountBoundaries (   $subject,
  $checkWriteAccess = false 
)

Checks if the given subject is within one of the registered user file mounts. If not, working with the file is not permitted for the user.

Parameters
ResourceInterface$subject‪file or folder
bool$checkWriteAccess‪If true, it is not only checked if the subject is within the file mount but also whether it isn't a read only file mount
Returns
‪bool

Definition at line 595 of file ResourceStorage.php.

References TYPO3\CMS\Webhooks\Message\$identifier, TYPO3\CMS\Core\Resource\ResourceStorage\getRootLevelFolder(), and TYPO3\CMS\Core\Resource\ResourceStorage\isWithinProcessingFolder().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\checkFileActionPermission(), and TYPO3\CMS\Core\Resource\ResourceStorage\checkFolderActionPermission().

◆ isWithinFolder()

bool TYPO3\CMS\Core\Resource\ResourceStorage::isWithinFolder ( Folder  $folder,
ResourceInterface  $resource 
)

◆ isWithinProcessingFolder()

bool TYPO3\CMS\Core\Resource\ResourceStorage::isWithinProcessingFolder (   $identifier)

◆ isWritable()

bool TYPO3\CMS\Core\Resource\ResourceStorage::isWritable ( )

Returns TRUE if this storage is writable. This is determined by the driver and the storage configuration; user permissions are not taken into account.

Returns
‪bool

Definition at line 391 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\Capabilities\CAPABILITY_WRITABLE, and TYPO3\CMS\Core\Resource\ResourceStorage\hasCapability().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\checkFileActionPermission(), TYPO3\CMS\Core\Resource\ResourceStorage\checkFolderActionPermission(), and TYPO3\CMS\Impexp\Import\isEquivalentStorage().

◆ markAsPermanentlyOffline()

TYPO3\CMS\Core\Resource\ResourceStorage::markAsPermanentlyOffline ( )

Blows the "fuse" and marks the storage as offline.

Can only be modified by an admin.

Typically, this is only done if the configuration is wrong.

Definition at line 500 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\getUid(), and TYPO3\CMS\Core\Resource\ResourceStorage\isOnline().

◆ markAsTemporaryOffline()

TYPO3\CMS\Core\Resource\ResourceStorage::markAsTemporaryOffline ( )

Marks this storage as offline for the next 5 minutes.

Non-permanent: This typically happens for remote storages that are "flaky" and not available all the time.

Definition at line 522 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\getUid(), and TYPO3\CMS\Core\Resource\ResourceStorage\isOnline().

◆ moveFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::moveFile (   $file,
  $targetFolder,
  $targetFileName = null,
  $conflictMode = DuplicationBehavior::RENAME 
)

Moves a $file into a $targetFolder the target folder has to be part of this storage

previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::func_move()

Parameters
FileInterface$file
Folder$targetFolder
string$targetFileName‪an optional destination fileName
string$conflictMode‪a value of the DuplicationBehavior enumeration
Exceptions
Exception

Definition at line 1933 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$this, TYPO3\CMS\Core\Resource\ResourceStorage\assureFileMovePermissions(), TYPO3\CMS\Core\Resource\DuplicationBehavior\CANCEL, TYPO3\CMS\Core\Type\Enumeration\cast(), TYPO3\CMS\Core\Resource\ResourceStorage\getIndexer(), TYPO3\CMS\Core\Resource\ResourceStorage\getUid(), TYPO3\CMS\Core\Resource\ResourceStorage\getUniqueName(), TYPO3\CMS\Core\Resource\DuplicationBehavior\RENAME, and TYPO3\CMS\Core\Resource\Index\Indexer\updateIndexEntry().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\deleteFile().

◆ moveFolder()

Folder TYPO3\CMS\Core\Resource\ResourceStorage::moveFolder ( Folder  $folderToMove,
Folder  $targetParentFolder,
  $newFolderName = null,
  $conflictMode = DuplicationBehavior::RENAME 
)

◆ moveFolderBetweenStorages()

TYPO3\CMS\Core\Resource\ResourceStorage::moveFolderBetweenStorages ( Folder  $folderToMove,
Folder  $targetParentFolder,
  $newFolderName 
)
protected

Moves the given folder from a different storage to the target folder in this storage.

Parameters
string$newFolderName
Exceptions
NotImplementedMethodException

Definition at line 2201 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\moveFolder().

◆ processFile()

TYPO3\CMS\Core\Resource\ResourceStorage::processFile ( File|FileReference  $fileObject,
string  $context,
array  $configuration 
)

◆ renameFile()

◆ renameFolder()

Folder TYPO3\CMS\Core\Resource\ResourceStorage::renameFolder (   $folderObject,
  $newName 
)

◆ replaceFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::replaceFile ( FileInterface  $file,
  $localFilePath 
)

◆ resetFileAndFolderNameFiltersToDefault()

TYPO3\CMS\Core\Resource\ResourceStorage::resetFileAndFolderNameFiltersToDefault ( )

Resets the file and folder name filters to the default values defined in the TYPO3 configuration.

Definition at line 1468 of file ResourceStorage.php.

References $GLOBALS, and TYPO3\CMS\Core\Resource\ResourceStorage\fileAndFolderNameFilters.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\__construct().

◆ sanitizeFileName()

string TYPO3\CMS\Core\Resource\ResourceStorage::sanitizeFileName (   $fileName,
Folder  $targetFolder = null 
)

Clean up a fileName from not allowed characters

Parameters
string$fileName‪The name of the file to be sanitized
Folder | null$targetFolder‪The target folder where the file is located or should be added
Returns
‪string

Definition at line 1187 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$this, and TYPO3\CMS\Core\Resource\ResourceStorage\getDefaultFolder().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\addFile().

◆ searchFiles()

TYPO3\CMS\Core\Resource\ResourceStorage::searchFiles ( FileSearchDemand  $searchDemand,
Folder  $folder = null,
bool  $useFilters = true 
)

Search for files in a storage based on given restrictions and a possibly given folder.

Parameters
Folder | null$folder
bool$useFilters‪Whether storage filters should be applied

Definition at line 421 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$this, TYPO3\CMS\Core\Resource\ResourceStorage\getRootLevelFolder(), and TYPO3\CMS\Core\Resource\Search\FileSearchDemand\withFolder().

◆ setConfiguration()

TYPO3\CMS\Core\Resource\ResourceStorage::setConfiguration ( array  $configuration)

Sets the configuration.

Definition at line 285 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$configuration.

◆ setDefault()

TYPO3\CMS\Core\Resource\ResourceStorage::setDefault (   $isDefault)

◆ setDriver()

ResourceStorage TYPO3\CMS\Core\Resource\ResourceStorage::setDriver ( DriverInterface  $driver)

Sets the storage that belongs to this storage.

Returns
ResourceStorage

Definition at line 305 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$driver, and TYPO3\CMS\Core\Resource\ResourceStorage\$this.

◆ setEvaluatePermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::setEvaluatePermissions (   $evaluatePermissions)

Sets whether the permissions to access or write into this storage should be checked or not.

Parameters
bool$evaluatePermissions

Definition at line 638 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$evaluatePermissions.

◆ setFileContents()

int TYPO3\CMS\Core\Resource\ResourceStorage::setFileContents ( AbstractFile  $file,
  $contents 
)

◆ setUserPermissions()

TYPO3\CMS\Core\Resource\ResourceStorage::setUserPermissions ( array  $userPermissions)

Sets the user permissions of the storage.

Definition at line 657 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\$userPermissions.

◆ streamFile()

TYPO3\CMS\Core\Resource\ResourceStorage::streamFile ( FileInterface  $file,
bool  $asDownload = false,
string  $alternativeFilename = null,
string  $overrideMimeType = null 
)

Returns a PSR-7 Response which can be used to stream the requested file

Parameters
bool$asDownload‪If set Content-Disposition attachment is sent, inline otherwise
string$alternativeFilename‪the filename for the download (if $asDownload is set)
string$overrideMimeType‪If set this will be used as Content-Type header instead of the automatically detected mime type.

Definition at line 1709 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceInterface\getIdentifier(), and TYPO3\CMS\Core\Resource\ResourceStorage\getPseudoStream().

◆ unsetFileAndFolderNameFilters()

TYPO3\CMS\Core\Resource\ResourceStorage::unsetFileAndFolderNameFilters ( )

Unsets the file and folder name filters, thus making this storage return unfiltered filelists.

Definition at line 1460 of file ResourceStorage.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\fileAndFolderNameFilters.

◆ updateProcessedFile()

FileInterface TYPO3\CMS\Core\Resource\ResourceStorage::updateProcessedFile (   $localFilePath,
ProcessedFile  $processedFile,
Folder  $processingFolder = null 
)

◆ usesCaseSensitiveIdentifiers()

bool TYPO3\CMS\Core\Resource\ResourceStorage::usesCaseSensitiveIdentifiers ( )

Returns TRUE if the identifiers used by this storage are case-sensitive.

Returns
‪bool

Definition at line 442 of file ResourceStorage.php.

Member Data Documentation

◆ $capabilities

Capabilities TYPO3\CMS\Core\Resource\ResourceStorage::$capabilities
protected

The capabilities of this storage as defined in the storage record.

Definition at line 175 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getCapabilities().

◆ $configuration

array TYPO3\CMS\Core\Resource\ResourceStorage::$configuration
protected

The configuration belonging to this storage (decoded from the configuration field).

Definition at line 144 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getConfiguration(), TYPO3\CMS\Core\Resource\ResourceStorage\processFile(), and TYPO3\CMS\Core\Resource\ResourceStorage\setConfiguration().

◆ $driver

Driver DriverInterface TYPO3\CMS\Core\Resource\ResourceStorage::$driver
protected

◆ $evaluatePermissions

bool TYPO3\CMS\Core\Resource\ResourceStorage::$evaluatePermissions = false
protected

Whether to check if file or folder is in user mounts and the action is allowed for a user Default is FALSE so that resources are accessible for front end rendering or admins.

Definition at line 157 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\deleteFile(), TYPO3\CMS\Core\Resource\ResourceStorage\getEvaluatePermissions(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolder(), and TYPO3\CMS\Core\Resource\ResourceStorage\setEvaluatePermissions().

◆ $eventDispatcher

EventDispatcherInterface TYPO3\CMS\Core\Resource\ResourceStorage::$eventDispatcher
protected

◆ $fileAndFolderNameFilters

array TYPO3\CMS\Core\Resource\ResourceStorage::$fileAndFolderNameFilters = array( )
protected

The filters used for the files and folder names.

Definition at line 205 of file ResourceStorage.php.

◆ $fileMounts

array TYPO3\CMS\Core\Resource\ResourceStorage::$fileMounts = array( )
protected

User filemounts, added as an array, and used as filters

Definition at line 163 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getFileMounts().

◆ $fileProcessingService

Service FileProcessingService TYPO3\CMS\Core\Resource\ResourceStorage::$fileProcessingService
protected

◆ $folderIdentifiers

TYPO3\CMS\Core\Resource\ResourceStorage::$folderIdentifiers = $this->driver->getFoldersInFolder($folder->getIdentifier(), $start, $maxNumberOfItems, $recursive, $filters, $sort, $sortRev)

Definition at line 2377 of file ResourceStorage.php.

◆ $folders [1/2]

foreach ( $this->getProcessingFolders() as $processingFolder) TYPO3\CMS\Core\Resource\ResourceStorage::$folders = []

Definition at line 2387 of file ResourceStorage.php.

◆ $folders [2/2]

foreach ( $folderIdentifiers as $folderIdentifier) return TYPO3\CMS\Core\Resource\ResourceStorage::$folders

Definition at line 2392 of file ResourceStorage.php.

◆ $isDefault

bool TYPO3\CMS\Core\Resource\ResourceStorage::$isDefault = false
protected

◆ $isOnline

bool TYPO3\CMS\Core\Resource\ResourceStorage::$isOnline
protected

whether this storage is online or offline in this request

Definition at line 195 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\isOnline().

◆ $processingFolder

◆ $processingFolders

Folder [] TYPO3\CMS\Core\Resource\ResourceStorage::$processingFolders
protected

All processing folders of this storage used in any storage

Definition at line 189 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolders().

◆ $storageRecord

array TYPO3\CMS\Core\Resource\ResourceStorage::$storageRecord
protected

The database record for this storage

Definition at line 138 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\__construct(), and TYPO3\CMS\Core\Resource\ResourceStorage\getStorageRecord().

◆ $this

◆ $userPermissions

array TYPO3\CMS\Core\Resource\ResourceStorage::$userPermissions = array( )
protected

The file permissions of the user (and their group) merged together and available as an array

Definition at line 170 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\setUserPermissions().

◆ fileAndFolderNameFilters

array<int, function getImportExportFilter(): array { $filter = GeneralUtility::makeInstance(ImportExportFilter::class); return [$filter, 'filterImportExportFilesAndFolders']; } public array function getFileAndFolderNameFilters() { return array_merge($this->fileAndFolderNameFilters, [$this->getImportExportFilter()]); } public $this function setFileAndFolderNameFilters(array $filters) { $this-> TYPO3\CMS\Core\Resource\ResourceStorage::fileAndFolderNameFilters = $filters

◆ PROCESSING_FOLDER_LEVELS

const TYPO3\CMS\Core\Resource\ResourceStorage::PROCESSING_FOLDER_LEVELS = 2

Levels numbers used to generate hashed subfolders in the processing folder

Definition at line 210 of file ResourceStorage.php.

Referenced by TYPO3\CMS\Core\Tests\Functional\Resource\StorageRepositoryTest\getNestedProcessingFolderTest().