TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ResourceStorage Class Reference
Inheritance diagram for ResourceStorage:
ResourceStorageInterface

Public Member Functions

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

Public Attributes

const PROCESSING_FOLDER_LEVELS = 2
 
- Public Attributes inherited from ResourceStorageInterface
const SIGNAL_SanitizeFileName = 'sanitizeFileName'
 
const SIGNAL_PreFileAdd = 'preFileAdd'
 
const SIGNAL_PostFileAdd = 'postFileAdd'
 
const SIGNAL_PostFileCreate = 'postFileCreate'
 
const SIGNAL_PreFileCopy = 'preFileCopy'
 
const SIGNAL_PostFileCopy = 'postFileCopy'
 
const SIGNAL_PreFileMove = 'preFileMove'
 
const SIGNAL_PostFileMove = 'postFileMove'
 
const SIGNAL_PreFileDelete = 'preFileDelete'
 
const SIGNAL_PostFileDelete = 'postFileDelete'
 
const SIGNAL_PreFileRename = 'preFileRename'
 
const SIGNAL_PostFileRename = 'postFileRename'
 
const SIGNAL_PreFileReplace = 'preFileReplace'
 
const SIGNAL_PostFileReplace = 'postFileReplace'
 
const SIGNAL_PostFileSetContents = 'postFileSetContents'
 
const SIGNAL_PreFolderAdd = 'preFolderAdd'
 
const SIGNAL_PostFolderAdd = 'postFolderAdd'
 
const SIGNAL_PreFolderCopy = 'preFolderCopy'
 
const SIGNAL_PostFolderCopy = 'postFolderCopy'
 
const SIGNAL_PreFolderMove = 'preFolderMove'
 
const SIGNAL_PostFolderMove = 'postFolderMove'
 
const SIGNAL_PreFolderDelete = 'preFolderDelete'
 
const SIGNAL_PostFolderDelete = 'postFolderDelete'
 
const SIGNAL_PreFolderRename = 'preFolderRename'
 
const SIGNAL_PostFolderRename = 'postFolderRename'
 
const SIGNAL_PreGeneratePublicUrl = 'preGeneratePublicUrl'
 
const CAPABILITY_BROWSABLE = 1
 
const CAPABILITY_PUBLIC = 2
 
const CAPABILITY_WRITABLE = 4
 
const DEFAULT_ProcessingFolder = '_processed_'
 

Protected Member Functions

 getDriver ()
 
 hasCapability ($capability)
 
 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)
 
 moveFolderBetweenStorages (Folder $folderToMove, Folder $targetParentFolder, $newFolderName)
 
 copyFolderBetweenStorages (Folder $folderToCopy, Folder $targetParentFolder, $newFolderName)
 
 emitSanitizeFileNameSignal ($fileName, Folder $targetFolder)
 
 emitPreFileAddSignal ($targetFileName, Folder $targetFolder, $sourceFilePath)
 
 emitPostFileAddSignal (FileInterface $file, Folder $targetFolder)
 
 emitPreFileCopySignal (FileInterface $file, Folder $targetFolder)
 
 emitPostFileCopySignal (FileInterface $file, Folder $targetFolder)
 
 emitPreFileMoveSignal (FileInterface $file, Folder $targetFolder)
 
 emitPostFileMoveSignal (FileInterface $file, Folder $targetFolder, FolderInterface $originalFolder)
 
 emitPreFileRenameSignal (FileInterface $file, $targetFolder)
 
 emitPostFileRenameSignal (FileInterface $file, $sanitizedTargetFileName)
 
 emitPreFileReplaceSignal (FileInterface $file, $localFilePath)
 
 emitPostFileReplaceSignal (FileInterface $file, $localFilePath)
 
 emitPostFileCreateSignal ($newFileIdentifier, Folder $targetFolder)
 
 emitPreFileDeleteSignal (FileInterface $file)
 
 emitPostFileDeleteSignal (FileInterface $file)
 
 emitPostFileSetContentsSignal (FileInterface $file, $content)
 
 emitPreFolderAddSignal (Folder $targetFolder, $name)
 
 emitPostFolderAddSignal (Folder $folder)
 
 emitPreFolderCopySignal (Folder $folder, Folder $targetFolder, $newName)
 
 emitPostFolderCopySignal (Folder $folder, Folder $targetFolder, $newName)
 
 emitPreFolderMoveSignal (Folder $folder, Folder $targetFolder, $newName)
 
 emitPostFolderMoveSignal (Folder $folder, Folder $targetFolder, $newName, Folder $originalFolder)
 
 emitPreFolderRenameSignal (Folder $folder, $newName)
 
 emitPostFolderRenameSignal (Folder $folder, $newName)
 
 emitPreFolderDeleteSignal (Folder $folder)
 
 emitPostFolderDeleteSignal (Folder $folder)
 
 emitPreGeneratePublicUrlSignal (ResourceInterface $resourceObject, $relativeToCurrentScript, array $urlData)
 
 getUniqueName (Folder $folder, $theFile, $dontCheckForUnique=false)
 
 getSignalSlotDispatcher ()
 
 getObjectManager ()
 
 getFileFactory ()
 
 getFileIndexRepository ()
 
 getFileProcessingService ()
 
 getNestedProcessingFolder (File $file, Folder $rootProcessingFolder)
 
 getNamesForNestedProcessingFolder ($fileIdentifier, $levels)
 
 getIndexer ()
 
 getBackendUser ()
 

Protected Attributes

 $driver
 
 $storageRecord
 
 $configuration
 
 $fileProcessingService
 
 $evaluatePermissions = false
 
 $fileMounts = []
 
 $userPermissions = []
 
 $capabilities
 
 $signalSlotDispatcher
 
 $processingFolder
 
 $processingFolders
 
 $isOnline = null
 
 $isDefault = false
 
 $fileAndFolderNameFilters = []
 

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 60 of file ResourceStorage.php.

Constructor & Destructor Documentation

__construct ( Driver\DriverInterface  $driver,
array  $storageRecord 
)

Constructor for a storage object.

Parameters
Driver\DriverInterface$driver
array$storageRecordThe storage record row from the database

Definition at line 168 of file ResourceStorage.php.

References ResourceStorage\$driver, ResourceStorage\$storageRecord, ResourceFactory\getInstance(), ResourceStorage\getName(), ResourceStorage\getUid(), ResourceStorage\isDefault(), ResourceStorage\isOnline(), and ResourceStorage\resetFileAndFolderNameFiltersToDefault().

Member Function Documentation

addFile (   $localFilePath,
Folder  $targetFolder,
  $targetFileName = '',
  $conflictMode = DuplicationBehavior::RENAME,
  $removeOriginal = true 
)

Moves a file from the local filesystem to this storage.

Parameters
string$localFilePathThe file on the server's hard disk to add
Folder$targetFolderThe target folder where the file should be added
string$targetFileNameThe name of the file to be add, If not set, the local file name is used
string$conflictModea value of the DuplicationBehavior enumeration
bool$removeOriginalif set the original file will be removed after successful operation
Exceptions
InvalidArgumentException
ExceptionExistingTargetFileNameException
Returns
FileInterface

Definition at line 1174 of file ResourceStorage.php.

References ResourceStorage\assureFileAddPermissions(), ResourceStorage\autoExtractMetadataEnabled(), PathUtility\basename(), DuplicationBehavior\CANCEL, Enumeration\cast(), ResourceStorage\emitPostFileAddSignal(), ResourceStorage\emitPreFileAddSignal(), PathUtility\getCanonicalPath(), ResourceStorage\getDefaultFolder(), Folder\getIdentifier(), ResourceFactory\getInstance(), ResourceStorage\getUid(), ResourceStorage\getUniqueName(), GeneralUtility\makeInstance(), DuplicationBehavior\RENAME, and ResourceStorage\sanitizeFileName().

Referenced by ResourceStorage\addUploadedFile().

addFileAndFolderNameFilter (   $filter)
Parameters
callable$filter

Definition at line 1447 of file ResourceStorage.php.

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
ExceptionFolderDoesNotExistException
Returns
void

Definition at line 451 of file ResourceStorage.php.

References ResourceFactory\getInstance().

Referenced by StoragePermissionsAspect\addFileMountsToStorage().

addUploadedFile ( array  $uploadedFileData,
Folder  $targetFolder = null,
  $targetFileName = null,
  $conflictMode = DuplicationBehavior::CANCEL 
)

Adds an uploaded file into the Storage. Previously in ::file_upload()

Parameters
array$uploadedFileDatacontains information about the uploaded file given by $_FILES['file1']
Folder$targetFolderthe target folder
string$targetFileNamethe file name to be written
string$conflictModea value of the DuplicationBehavior enumeration
Returns
FileInterface The file object

Definition at line 1939 of file ResourceStorage.php.

References ResourceStorage\addFile(), ResourceStorage\assureFileUploadPermissions(), Enumeration\cast(), ResourceStorage\getDefaultFolder(), ResourceStorage\getFileInFolder(), ResourceStorage\hasFileInFolder(), DuplicationBehavior\REPLACE, and ResourceStorage\replaceFile().

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$targetFolderThe target folder where the file should be written
string$targetFileNameThe file name which should be written into the storage
Returns
void
Exceptions
ExceptionInsufficientFolderWritePermissionsException
ExceptionIllegalFileExtensionException
ExceptionInsufficientUserPermissionsException

Definition at line 917 of file ResourceStorage.php.

References ResourceStorage\checkFileExtensionPermission(), ResourceStorage\checkFolderActionPermission(), ResourceStorage\checkUserActionPermission(), and ResourceStorage\getUid().

Referenced by ResourceStorage\addFile(), ResourceStorage\assureFileUploadPermissions(), and ResourceStorage\createFile().

assureFileCopyPermissions ( FileInterface  $file,
Folder  $targetFolder,
  $targetFileName 
)
protected

Check if a file has the permission to be copied on a File/Folder/Storage, if not throw an exception

Parameters
FileInterface$file
Folder$targetFolder
string$targetFileName
Exceptions
Exception
ExceptionInsufficientFolderWritePermissionsException
ExceptionIllegalFileExtensionException
ExceptionInsufficientFileReadPermissionsException
ExceptionInsufficientUserPermissionsException
Returns
void

Definition at line 1041 of file ResourceStorage.php.

References ResourceStorage\checkFileExtensionPermission(), ResourceStorage\checkFolderActionPermission(), ResourceInterface\getIdentifier(), Folder\getIdentifier(), ResourceInterface\getName(), ResourceInterface\getStorage(), Folder\getStorage(), and ResourceStorage\getUid().

assureFileDeletePermissions ( FileInterface  $file)
protected

Assures delete permission for given file.

Parameters
FileInterface$file
Returns
void
Exceptions
ExceptionIllegalFileExtensionException
ExceptionInsufficientFileWritePermissionsException
ExceptionInsufficientFolderWritePermissionsException

Definition at line 884 of file ResourceStorage.php.

References ResourceStorage\checkFileActionPermission(), ResourceStorage\checkFileExtensionPermission(), ResourceStorage\checkUserActionPermission(), FileInterface\getExtension(), ResourceInterface\getIdentifier(), and ResourceInterface\getName().

Referenced by ResourceStorage\deleteFile().

assureFileMovePermissions ( FileInterface  $file,
Folder  $targetFolder,
  $targetFileName 
)
protected

Checks for permissions to move a file.

Exceptions
RuntimeException
ExceptionInsufficientFolderAccessPermissionsException
ExceptionInsufficientUserPermissionsException
ExceptionIllegalFileExtensionException
Parameters
FileInterface$file
Folder$targetFolder
string$targetFileName
Returns
void

Definition at line 976 of file ResourceStorage.php.

References ResourceStorage\checkFileExtensionPermission(), ResourceStorage\checkFolderActionPermission(), Folder\getIdentifier(), ResourceInterface\getStorage(), Folder\getStorage(), and ResourceStorage\getUid().

Referenced by ResourceStorage\moveFile().

assureFileReadPermission ( FileInterface  $file)
protected

Assures read permission for given file.

Parameters
FileInterface$file
Returns
void
Exceptions
ExceptionInsufficientFileAccessPermissionsException
ExceptionIllegalFileExtensionException

Definition at line 819 of file ResourceStorage.php.

References ResourceStorage\checkFileActionPermission(), ResourceStorage\checkFileExtensionPermission(), and ResourceInterface\getName().

Referenced by ResourceStorage\getFileContents().

assureFileRenamePermissions ( FileInterface  $file,
  $targetFileName 
)
protected

Checks for permissions to rename a file.

Parameters
FileInterface$file
string$targetFileName
Exceptions
ExceptionInsufficientFileWritePermissionsException
ExceptionIllegalFileExtensionException
ExceptionInsufficientFileReadPermissionsException
ExceptionInsufficientUserPermissionsException
Returns
void

Definition at line 1007 of file ResourceStorage.php.

References ResourceStorage\checkFileActionPermission(), ResourceStorage\checkFileExtensionPermission(), ResourceStorage\checkFolderActionPermission(), and ResourceInterface\getName().

Referenced by ResourceStorage\renameFile().

assureFileReplacePermissions ( FileInterface  $file)
protected

Assure replace permission for given file.

Parameters
FileInterface$file
Returns
void
Exceptions
ExceptionInsufficientFileWritePermissionsException
ExceptionInsufficientFolderWritePermissionsException

Definition at line 863 of file ResourceStorage.php.

References ResourceStorage\checkFileActionPermission(), ResourceStorage\checkFolderActionPermission(), ResourceInterface\getIdentifier(), and ResourceInterface\getParentFolder().

Referenced by ResourceStorage\replaceFile().

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$localFilePaththe temporary file name from $_FILES['file1']['tmp_name']
Folder$targetFolderThe target folder where the file should be uploaded
string$targetFileNamethe destination file name $_FILES['file1']['name']
int$uploadedFileSize
Returns
void
Exceptions
ExceptionInsufficientFolderWritePermissionsException
ExceptionUploadException
ExceptionIllegalFileExtensionException
ExceptionUploadSizeException
ExceptionInsufficientUserPermissionsException

Definition at line 949 of file ResourceStorage.php.

References ResourceStorage\assureFileAddPermissions(), and GeneralUtility\getMaxUploadFileSize().

Referenced by ResourceStorage\addUploadedFile().

assureFileWritePermissions ( FileInterface  $file)
protected

Assures write permission for given file.

Parameters
FileInterface$file
Returns
void
Exceptions
ExceptionIllegalFileExtensionException
ExceptionInsufficientFileWritePermissionsException
ExceptionInsufficientUserPermissionsException

Definition at line 844 of file ResourceStorage.php.

References ResourceStorage\checkFileActionPermission(), ResourceStorage\checkFileExtensionPermission(), FileInterface\getExtension(), ResourceInterface\getIdentifier(), and ResourceInterface\getName().

Referenced by ResourceStorage\setFileContents().

assureFolderCopyPermissions ( FolderInterface  $folderToCopy,
FolderInterface  $targetParentFolder 
)
protected

Check if a file has the permission to be copied on a File/Folder/Storage, if not throw an exception

Parameters
FolderInterface$folderToCopy
FolderInterface$targetParentFolder
Returns
void
Exceptions
Exception
ExceptionInsufficientFolderWritePermissionsException
ExceptionIllegalFileExtensionException
ExceptionInsufficientFileReadPermissionsException
ExceptionInsufficientUserPermissionsException
RuntimeException

Definition at line 1076 of file ResourceStorage.php.

References ResourceStorage\checkFolderActionPermission(), ResourceInterface\getIdentifier(), ResourceInterface\getStorage(), and ResourceStorage\getUid().

Referenced by ResourceStorage\copyFolder().

assureFolderDeletePermission ( Folder  $folder,
  $checkDeleteRecursively 
)
protected

Assures delete permission for given folder.

Parameters
Folder$folderIf a folder is given, mountpoints are checked. If not only user folder delete permissions are checked.
bool$checkDeleteRecursively
Returns
void
Exceptions
ExceptionInsufficientFolderAccessPermissionsException
ExceptionInsufficientFolderWritePermissionsException
ExceptionInsufficientUserPermissionsException

Definition at line 790 of file ResourceStorage.php.

References ResourceStorage\checkFolderActionPermission(), ResourceStorage\checkUserActionPermission(), and Folder\getName().

Referenced by ResourceStorage\deleteFolder().

assureFolderMovePermissions ( FolderInterface  $folderToMove,
FolderInterface  $targetParentFolder 
)
protected

Check if a file has the permission to be copied on a File/Folder/Storage, if not throw an exception

Parameters
FolderInterface$folderToMove
FolderInterface$targetParentFolder
Exceptions
InvalidArgumentException
ExceptionInsufficientFolderWritePermissionsException
ExceptionIllegalFileExtensionException
ExceptionInsufficientFileReadPermissionsException
ExceptionInsufficientUserPermissionsException
RuntimeException
Returns
void

Definition at line 1113 of file ResourceStorage.php.

References ResourceStorage\checkFolderActionPermission(), ResourceInterface\getIdentifier(), ResourceInterface\getStorage(), and ResourceStorage\getUid().

Referenced by ResourceStorage\moveFolder().

assureFolderReadPermission ( Folder  $folder = null)
protected

Assures read permission for given folder.

Parameters
Folder$folderIf a folder is given, mountpoints are checked. If not only user folder read permissions are checked.
Returns
void
Exceptions
ExceptionInsufficientFolderAccessPermissionsException

Definition at line 763 of file ResourceStorage.php.

References ResourceStorage\checkFolderActionPermission().

Referenced by ResourceStorage\countFilesInFolder(), ResourceStorage\countFoldersInFolder(), ResourceStorage\getFilesInFolder(), ResourceStorage\getFolder(), ResourceStorage\hasFile(), ResourceStorage\hasFileInFolder(), ResourceStorage\hasFolder(), and ResourceStorage\hasFolderInFolder().

autoExtractMetadataEnabled ( )

Returns TRUE if auto extracting of metadata is enabled

Returns
bool

Definition at line 392 of file ResourceStorage.php.

Referenced by ResourceStorage\addFile(), and ResourceStorage\replaceFile().

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$actionaction, can be read, write, delete
FileInterface$file
Returns
bool

Definition at line 608 of file ResourceStorage.php.

References ResourceStorage\checkFileExtensionPermission(), ResourceStorage\checkUserActionPermission(), ResourceInterface\getIdentifier(), ResourceInterface\getName(), and ResourceStorage\isWritable().

Referenced by ResourceStorage\assureFileDeletePermissions(), ResourceStorage\assureFileReadPermission(), ResourceStorage\assureFileRenamePermissions(), ResourceStorage\assureFileReplacePermissions(), and ResourceStorage\assureFileWritePermissions().

checkFileExtensionPermission (   $fileName)
protected
checkUserActionPermission (   $action,
  $type 
)

Checks if the ACL settings allow for a certain action (is a user allowed to read a file or copy a folder).

Parameters
string$action
string$typeeither File or Folder
Returns
bool

Definition at line 581 of file ResourceStorage.php.

Referenced by ResourceStorage\assureFileAddPermissions(), ResourceStorage\assureFileDeletePermissions(), ResourceStorage\assureFolderDeletePermission(), ResourceStorage\checkFileActionPermission(), and ResourceStorage\checkFolderActionPermission().

copyFile ( FileInterface  $file,
Folder  $targetFolder,
  $targetFileName = null,
  $conflictMode = DuplicationBehavior::RENAME 
)

Previously in ::func_copy() copies a source file (from any location) in to the target folder, the latter has to be part of this storage

Parameters
FileInterface$file
Folder$targetFolder
string$targetFileNamean optional destination fileName
string$conflictModea value of the DuplicationBehavior enumeration
Exceptions
Exception|Exception
ExceptionExistingTargetFileNameException
Returns
FileInterface

Definition at line 1769 of file ResourceStorage.php.

copyFolder ( FolderInterface  $folderToCopy,
FolderInterface  $targetParentFolder,
  $newFolderName = null,
  $conflictMode = DuplicationBehavior::RENAME 
)

Copies a folder.

Parameters
FolderInterface$folderToCopyThe folder to copy
FolderInterface$targetParentFolderThe target folder
string$newFolderName
string$conflictModea value of the DuplicationBehavior enumeration
Returns
Folder The new (copied) folder object
Exceptions
InvalidTargetFolderException

Definition at line 2065 of file ResourceStorage.php.

References ResourceStorage\assureFolderCopyPermissions(), ResourceStorage\copyFolderBetweenStorages(), ResourceStorage\emitPostFolderCopySignal(), ResourceStorage\emitPreFolderCopySignal(), ResourceStorage\getFolder(), ResourceInterface\getIdentifier(), ResourceInterface\getName(), ResourceInterface\getStorage(), FolderInterface\getSubfolder(), and ResourceStorage\isWithinFolder().

copyFolderBetweenStorages ( Folder  $folderToCopy,
Folder  $targetParentFolder,
  $newFolderName 
)
protected

Copies a folder between storages.

Parameters
Folder$folderToCopy
Folder$targetParentFolder
string$newFolderName
Returns
bool
Exceptions
RuntimeException

Definition at line 2107 of file ResourceStorage.php.

Referenced by ResourceStorage\copyFolder().

countFilesInFolder ( Folder  $folder,
  $useFilters = true,
  $recursive = false 
)
Parameters
Folder$folder
bool$useFilters
bool$recursive
Returns
int Number of files in folder
Exceptions
ExceptionInsufficientFolderAccessPermissionsException

Definition at line 1537 of file ResourceStorage.php.

References ResourceStorage\assureFolderReadPermission(), and Folder\getIdentifier().

countFoldersInFolder ( Folder  $folder,
  $useFilters = true,
  $recursive = false 
)
Parameters
Folder$folder
bool$useFilters
bool$recursive
Returns
int Number of subfolders
Exceptions
ExceptionInsufficientFolderAccessPermissionsException

Definition at line 2243 of file ResourceStorage.php.

References ResourceStorage\assureFolderReadPermission(), and Folder\getIdentifier().

createFile (   $fileName,
Folder  $targetFolderObject 
)

Creates a new file

previously in ::func_newfile()

Parameters
string$fileNameThe name of the file to be created
Folder$targetFolderObjectThe target folder where the file should be created
Exceptions
ExceptionIllegalFileExtensionException
ExceptionInsufficientFolderWritePermissionsException
Returns
FileInterface The file object

Definition at line 1717 of file ResourceStorage.php.

References ResourceStorage\assureFileAddPermissions(), ResourceStorage\emitPostFileCreateSignal(), Folder\getIdentifier(), ResourceFactory\getInstance(), and ResourceStorage\getUid().

createFolder (   $folderName,
Folder  $parentFolder = null 
)

Creates a new folder.

previously in ::func_newfolder()

Parameters
string$folderNameThe 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
ExceptionExistingTargetFolderException
ExceptionInsufficientFolderAccessPermissionsException
ExceptionInsufficientFolderWritePermissionsException
Exception

Definition at line 2288 of file ResourceStorage.php.

References ResourceStorage\checkFolderActionPermission(), ResourceStorage\emitPostFolderAddSignal(), ResourceStorage\emitPreFolderAddSignal(), ResourceStorage\getDriver(), ResourceStorage\getFolder(), and ResourceStorage\getRootLevelFolder().

Referenced by ResourceStorage\getProcessingFolder().

deleteFile (   $fileObject)

Previously in ::deleteFile()

Parameters
FileInterface$fileObject
Exceptions
ExceptionInsufficientFileAccessPermissionsException
ExceptionFileOperationErrorException
Returns
bool TRUE if deletion succeeded

Definition at line 1733 of file ResourceStorage.php.

References ResourceStorage\assureFileDeletePermissions(), and ResourceStorage\emitPreFileDeleteSignal().

Referenced by ResourceStorage\deleteFolder().

deleteFolder (   $folderObject,
  $deleteRecursively = false 
)

Previously in ::folder_delete()

Parameters
Folder$folderObject
bool$deleteRecursively
Exceptions
RuntimeException
ExceptionInsufficientFolderAccessPermissionsException
ExceptionInsufficientUserPermissionsException
ExceptionFileOperationErrorException
ExceptionInvalidPathException
Returns
bool

Definition at line 2165 of file ResourceStorage.php.

References ResourceStorage\assureFolderDeletePermission(), ResourceStorage\deleteFile(), ResourceStorage\emitPostFolderDeleteSignal(), ResourceStorage\emitPreFolderDeleteSignal(), and ResourceStorage\getFilesInFolder().

dumpFileContents ( FileInterface  $file,
  $asDownload = false,
  $alternativeFilename = null,
  $overrideMimeType = null 
)

Outputs file Contents, clears output buffer first and sends headers accordingly.

Parameters
FileInterface$file
bool$asDownloadIf set Content-Disposition attachment is sent, inline otherwise
string$alternativeFilenamethe filename for the download (if $asDownload is set)
string$overrideMimeTypeIf set this will be used as Content-Type header instead of the automatically detected mime type.
Returns
void

Definition at line 1657 of file ResourceStorage.php.

References ResourceInterface\getIdentifier(), FileInterface\getMimeType(), ResourceInterface\getName(), and FileInterface\getSize().

emitPostFileAddSignal ( FileInterface  $file,
Folder  $targetFolder 
)
protected

Emits the file post-add signal.

Parameters
FileInterface$file
Folder$targetFolder
Returns
void

Definition at line 2456 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\addFile().

emitPostFileCopySignal ( FileInterface  $file,
Folder  $targetFolder 
)
protected

Emits the file post-copy signal.

Parameters
FileInterface$file
Folder$targetFolder
Returns
void

Definition at line 2480 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

emitPostFileCreateSignal (   $newFileIdentifier,
Folder  $targetFolder 
)
protected

Emits the file post-create signal

Parameters
string$newFileIdentifier
Folder$targetFolder

Definition at line 2564 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\createFile().

emitPostFileDeleteSignal ( FileInterface  $file)
protected

Emits the file post-deletion signal

Parameters
FileInterface$file
Returns
void

Definition at line 2586 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

emitPostFileMoveSignal ( FileInterface  $file,
Folder  $targetFolder,
FolderInterface  $originalFolder 
)
protected

Emits the file post-move signal.

Parameters
FileInterface$file
Folder$targetFolder
FolderInterface$originalFolder
Returns
void

Definition at line 2505 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\moveFile().

emitPostFileRenameSignal ( FileInterface  $file,
  $sanitizedTargetFileName 
)
protected

Emits the file post-rename signal.

Parameters
FileInterface$file
string$sanitizedTargetFileName
Returns
void

Definition at line 2529 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\renameFile().

emitPostFileReplaceSignal ( FileInterface  $file,
  $localFilePath 
)
protected

Emits the file post-replace signal

Parameters
FileInterface$file
string$localFilePath
Returns
void

Definition at line 2553 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\replaceFile().

emitPostFileSetContentsSignal ( FileInterface  $file,
  $content 
)
protected

Emits the file post-set-contents signal

Parameters
FileInterface$file
mixed$content
Returns
void

Definition at line 2598 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\setFileContents().

emitPostFolderAddSignal ( Folder  $folder)
protected

Emits the folder post-add signal.

Parameters
Folder$folder
Returns
void

Definition at line 2621 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\createFolder().

emitPostFolderCopySignal ( Folder  $folder,
Folder  $targetFolder,
  $newName 
)
protected

Emits the folder post-copy signal.

Parameters
Folder$folder
Folder$targetFolder
$newName
Returns
void

Definition at line 2647 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\copyFolder().

emitPostFolderDeleteSignal ( Folder  $folder)
protected

Emits folder post-deletion signal..

Parameters
Folder$folder
Returns
void

Definition at line 2720 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\deleteFolder().

emitPostFolderMoveSignal ( Folder  $folder,
Folder  $targetFolder,
  $newName,
Folder  $originalFolder 
)
protected

Emits the folder post-move signal.

Parameters
Folder$folder
Folder$targetFolder
string$newName
Folder$originalFolder
Returns
void

Definition at line 2674 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\moveFolder().

emitPostFolderRenameSignal ( Folder  $folder,
  $newName 
)
protected

Emits the folder post-rename signal.

Parameters
Folder$folder
string$newName
Returns
void

Definition at line 2698 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\renameFolder().

emitPreFileAddSignal (   $targetFileName,
Folder  $targetFolder,
  $sourceFilePath 
)
protected

Emits file pre-add signal.

Parameters
string$targetFileName
Folder$targetFolder
string$sourceFilePath
Returns
string Modified target file name

Definition at line 2443 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\addFile().

emitPreFileCopySignal ( FileInterface  $file,
Folder  $targetFolder 
)
protected

Emits file pre-copy signal.

Parameters
FileInterface$file
Folder$targetFolder
Returns
void

Definition at line 2468 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

emitPreFileDeleteSignal ( FileInterface  $file)
protected

Emits the file pre-deletion signal.

Parameters
FileInterface$file
Returns
void

Definition at line 2575 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\deleteFile().

emitPreFileMoveSignal ( FileInterface  $file,
Folder  $targetFolder 
)
protected

Emits the file pre-move signal.

Parameters
FileInterface$file
Folder$targetFolder
Returns
void

Definition at line 2492 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\moveFile().

emitPreFileRenameSignal ( FileInterface  $file,
  $targetFolder 
)
protected

Emits the file pre-rename signal

Parameters
FileInterface$file
$targetFolder
Returns
void

Definition at line 2517 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\renameFile().

emitPreFileReplaceSignal ( FileInterface  $file,
  $localFilePath 
)
protected

Emits the file pre-replace signal.

Parameters
FileInterface$file
$localFilePath
Returns
void

Definition at line 2541 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\replaceFile().

emitPreFolderAddSignal ( Folder  $targetFolder,
  $name 
)
protected

Emits the folder pre-add signal.

Parameters
Folder$targetFolder
string$name
Returns
void

Definition at line 2610 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\createFolder().

emitPreFolderCopySignal ( Folder  $folder,
Folder  $targetFolder,
  $newName 
)
protected

Emits the folder pre-copy signal.

Parameters
Folder$folder
Folder$targetFolder
$newName
Returns
void

Definition at line 2634 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\copyFolder().

emitPreFolderDeleteSignal ( Folder  $folder)
protected

Emits the folder pre-deletion signal.

Parameters
Folder$folder
Returns
void

Definition at line 2709 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\deleteFolder().

emitPreFolderMoveSignal ( Folder  $folder,
Folder  $targetFolder,
  $newName 
)
protected

Emits the folder pre-move signal.

Parameters
Folder$folder
Folder$targetFolder
$newName
Returns
void

Definition at line 2660 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\moveFolder().

emitPreFolderRenameSignal ( Folder  $folder,
  $newName 
)
protected

Emits the folder pre-rename signal.

Parameters
Folder$folder
string$newName
Returns
void

Definition at line 2686 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\renameFolder().

emitPreGeneratePublicUrlSignal ( ResourceInterface  $resourceObject,
  $relativeToCurrentScript,
array  $urlData 
)
protected

Emits file pre-processing signal when generating a public url for a file or folder.

Parameters
ResourceInterface$resourceObject
bool$relativeToCurrentScript
array$urlData

Definition at line 2732 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\getPublicUrl().

emitSanitizeFileNameSignal (   $fileName,
Folder  $targetFolder 
)
protected

Emits sanitize fileName signal.

Parameters
string$fileName
Folder$targetFolder
Returns
string Modified target file name

Definition at line 2429 of file ResourceStorage.php.

References ResourceStorage\getSignalSlotDispatcher().

Referenced by ResourceStorage\sanitizeFileName().

getBackendUser ( )
protected

Returns the current BE user.

Returns

Definition at line 3029 of file ResourceStorage.php.

References $GLOBALS.

getCapabilities ( )

Returns the capabilities of this storage.

Returns
int
See also
CAPABILITY_* constants

Definition at line 293 of file ResourceStorage.php.

References ResourceStorage\$capabilities.

getConfiguration ( )

Gets the configuration.

Returns
array

Definition at line 207 of file ResourceStorage.php.

References ResourceStorage\$configuration.

Referenced by Import\isEquivalentObjectStorage().

getDefaultFolder ( )

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

Returns
Folder

Definition at line 2328 of file ResourceStorage.php.

References ResourceStorage\getFolder().

Referenced by ResourceStorage\addFile(), ResourceStorage\addUploadedFile(), and ResourceStorage\sanitizeFileName().

getDriver ( )
protected

Returns the driver object belonging to this storage.

Returns
Driver

Definition at line 249 of file ResourceStorage.php.

References ResourceStorage\$driver.

Referenced by ResourceStorage\createFolder().

getDriverType ( )

Gets the driver Type configured for this storage.

Returns
string

Definition at line 2992 of file ResourceStorage.php.

Referenced by Import\isEquivalentObjectStorage().

getEvaluatePermissions ( )

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

Returns
bool $evaluatePermissions

Definition at line 557 of file ResourceStorage.php.

References ResourceStorage\$evaluatePermissions.

getFile (   $identifier)

Gets a file by identifier.

Parameters
string$identifier
Returns
FileInterface

Definition at line 1370 of file ResourceStorage.php.

References ResourceStorage\getFileFactory(), and ResourceStorage\getUid().

getFileAndFolderNameFilters ( )

Returns the file and folder name filters used by this storage.

Returns
array

Definition at line 1429 of file ResourceStorage.php.

References ResourceStorage\$fileAndFolderNameFilters.

getFileContents (   $file)

Get contents of a file object

Parameters
FileInterface$file
Exceptions
ExceptionInsufficientFileReadPermissionsException
Returns
string

Definition at line 1641 of file ResourceStorage.php.

References ResourceStorage\assureFileReadPermission().

getFileForLocalProcessing ( FileInterface  $fileObject,
  $writable = true 
)

Copies a file from the storage for local processing.

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

Definition at line 1358 of file ResourceStorage.php.

References ResourceInterface\getIdentifier().

getFileIdentifiersInFolder (   $folderIdentifier,
  $useFilters = true,
  $recursive = false 
)
Parameters
string$folderIdentifier
bool$useFilters
bool$recursive
Returns
array

Definition at line 1524 of file ResourceStorage.php.

getFileIndexRepository ( )
protected
Returns
Index

Definition at line 2824 of file ResourceStorage.php.

References FileIndexRepository\getInstance().

Referenced by ResourceStorage\getFilesInFolder().

getFileInfo ( FileInterface  $fileObject)

Gets information about a file.

Parameters
FileInterface$fileObject
Returns
array

Definition at line 1386 of file ResourceStorage.php.

References ResourceStorage\getFileInfoByIdentifier(), and ResourceInterface\getIdentifier().

getFileInfoByIdentifier (   $identifier,
array  $propertiesToExtract = [] 
)

Gets information about a file by its identifier.

Parameters
string$identifier
array$propertiesToExtract
Returns
array

Definition at line 1399 of file ResourceStorage.php.

Referenced by ResourceStorage\getFileInfo().

getFileInFolder (   $fileName,
Folder  $folder 
)

Get file from folder

Parameters
string$fileName
Folder$folder
Returns
NULL|File|ProcessedFile

Definition at line 1469 of file ResourceStorage.php.

References ResourceStorage\getFileFactory(), Folder\getIdentifier(), and ResourceStorage\getUid().

Referenced by ResourceStorage\addUploadedFile().

getFileMounts ( )

Returns all file mounts that are registered with this storage.

Returns
array

Definition at line 491 of file ResourceStorage.php.

References ResourceStorage\$fileMounts.

getFileProcessingService ( )
protected
getFilesInFolder ( Folder  $folder,
  $start = 0,
  $maxNumberOfItems = 0,
  $useFilters = true,
  $recursive = false,
  $sort = '',
  $sortRev = false 
)
Parameters
Folder$folder
int$start
int$maxNumberOfItems
bool$useFilters
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
File[]
Exceptions
ExceptionInsufficientFolderAccessPermissionsException

Definition at line 1490 of file ResourceStorage.php.

References ResourceStorage\assureFolderReadPermission(), ResourceStorage\getFileFactory(), ResourceStorage\getFileIndexRepository(), Folder\getIdentifier(), and ResourceStorage\getUid().

Referenced by ResourceStorage\deleteFolder().

getFolder (   $identifier,
  $returnInaccessibleFolderObject = false 
)
getFolderIdentifierFromFileIdentifier (   $fileIdentifier)
Parameters
string$fileIdentifier
Returns
string

Definition at line 1457 of file ResourceStorage.php.

getFolderIdentifiersInFolder (   $folderIdentifier,
  $useFilters = true,
  $recursive = false 
)
Parameters
string$folderIdentifier
bool$useFilters
bool$recursive
Returns
array

Definition at line 1550 of file ResourceStorage.php.

getFolderInfo ( Folder  $folder)

Retrieves information about a folder

Parameters
Folder$folder
Returns
array

Definition at line 2318 of file ResourceStorage.php.

References Folder\getIdentifier().

getFolderInFolder (   $folderName,
Folder  $parentFolder,
  $returnInaccessibleFolderObject = false 
)

Returns the Identifier for a folder within a given folder.

Parameters
string$folderNameThe name of the target folder
Folder$parentFolder
bool$returnInaccessibleFolderObject
Returns
Folder|InaccessibleFolder
Exceptions
Exception
ExceptionInsufficientFolderAccessPermissionsException

Definition at line 2196 of file ResourceStorage.php.

References ResourceStorage\getFolder(), and Folder\getIdentifier().

getFoldersInFolder ( Folder  $folder,
  $start = 0,
  $maxNumberOfItems = 0,
  $useFilters = true,
  $recursive = false,
  $sort = '',
  $sortRev = false 
)
Parameters
Folder$folder
int$start
int$maxNumberOfItems
bool$useFilters
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
Folder[]

Definition at line 2216 of file ResourceStorage.php.

References ResourceStorage\$processingFolder, ResourceStorage\getFolder(), and Folder\getIdentifier().

getName ( )

Returns the name of this storage.

Returns
string

Definition at line 259 of file ResourceStorage.php.

Referenced by ResourceStorage\__construct().

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 2974 of file ResourceStorage.php.

Referenced by ResourceStorage\getNestedProcessingFolder().

getNestedProcessingFolder ( File  $file,
Folder  $rootProcessingFolder 
)
protected

Getter function to return the the file's corresponding hashed subfolder of the processed folder

Parameters
File$file
Folder$rootProcessingFolder
Returns
Folder
Exceptions
ExceptionInsufficientFolderWritePermissionsException

Definition at line 2942 of file ResourceStorage.php.

References ResourceStorage\$processingFolder, AbstractFile\getIdentifier(), and ResourceStorage\getNamesForNestedProcessingFolder().

Referenced by ResourceStorage\getProcessingFolder().

getObjectManager ( )
protected

Gets the ObjectManager.

Returns
ObjectManager

Definition at line 2808 of file ResourceStorage.php.

References GeneralUtility\makeInstance().

Referenced by ResourceStorage\getSignalSlotDispatcher().

getProcessingFolder ( File  $file = null)

Getter function to return the folder where the files can be processed. Does not check for access rights here.

Parameters
File$fileSpecific file you want to have the processing folder for
Returns
Folder

Definition at line 2877 of file ResourceStorage.php.

References ResourceStorage\$evaluatePermissions, ResourceStorage\$processingFolder, ResourceStorage\createFolder(), ResourceFactory\getInstance(), ResourceStorage\getNestedProcessingFolder(), ResourceStorage\getRootLevelFolder(), and GeneralUtility\makeInstance().

Referenced by ResourceStorage\updateProcessedFile().

getPublicUrl ( ResourceInterface  $resourceObject,
  $relativeToCurrentScript = false 
)

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$resourceObjectThe file or folder object
bool$relativeToCurrentScriptDetermines whether the URL returned should be relative to the current script, in case it is relative at all (only for the LocalDriver)
Returns
string

Definition at line 1283 of file ResourceStorage.php.

References PathUtility\dirname(), ResourceStorage\emitPreGeneratePublicUrlSignal(), ResourceInterface\getIdentifier(), OnlineMediaHelperRegistry\getInstance(), PathUtility\getRelativePathTo(), ResourceStorage\hasCapability(), GeneralUtility\hmac(), ResourceStorage\isOnline(), and GeneralUtility\isValidUrl().

getRole ( FolderInterface  $folder)
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

Definition at line 2412 of file ResourceStorage.php.

References ResourceFactory\getInstance().

Referenced by ResourceStorage\createFolder(), and ResourceStorage\getProcessingFolder().

getStorageRecord ( )

Gets the storage record.

Returns
array

Definition at line 227 of file ResourceStorage.php.

References ResourceStorage\$storageRecord.

getUniqueName ( Folder  $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
Folder$folder
string$theFileThe input fileName to check
bool$dontCheckForUniqueIf set the fileName is returned with the path prepended without checking whether it already existed!
Exceptions
RuntimeException
Returns
string A unique fileName inside $folder, based on $theFile.
See also
::getUniqueName()

Definition at line 2750 of file ResourceStorage.php.

References Folder\getIdentifier(), and PathUtility\pathinfo().

Referenced by ResourceStorage\addFile(), and ResourceStorage\moveFile().

hasCapability (   $capability)
protected

Returns TRUE if this storage has the given capability.

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

Definition at line 304 of file ResourceStorage.php.

Referenced by ResourceStorage\getPublicUrl(), ResourceStorage\isBrowsable(), ResourceStorage\isPublic(), and ResourceStorage\isWritable().

hasChildren ( )

Tells whether there are children in this storage.

Returns
bool

Definition at line 279 of file ResourceStorage.php.

hasFile (   $identifier)

Returns TRUE if the specified file exists

Parameters
string$identifier
Returns
bool

Definition at line 1562 of file ResourceStorage.php.

References ResourceStorage\assureFolderReadPermission(), and ResourceStorage\isWithinProcessingFolder().

Referenced by ProcessedFileRepository\findByStorageAndIdentifier().

hasFileInFolder (   $fileName,
Folder  $folder 
)

Checks if the queried file in the given folder exists

Parameters
string$fileName
Folder$folder
Returns
bool

Definition at line 1627 of file ResourceStorage.php.

References ResourceStorage\assureFolderReadPermission(), and Folder\getIdentifier().

Referenced by ResourceStorage\addUploadedFile().

hasFolder (   $identifier)

Returns TRUE if the specified folder exists.

Parameters
string$identifier
Returns
bool

Definition at line 2256 of file ResourceStorage.php.

References ResourceStorage\assureFolderReadPermission().

hasFolderInFolder (   $folderName,
Folder  $folder 
)

Checks if the given file exists in the given folder

Parameters
string$folderName
Folder$folder
Returns
bool

Definition at line 2269 of file ResourceStorage.php.

References ResourceStorage\assureFolderReadPermission(), and Folder\getIdentifier().

hashFile ( FileInterface  $fileObject,
  $hash 
)

Creates a (cryptographic) hash for a file.

Parameters
FileInterface$fileObject
string$hash
Returns
string

Definition at line 1238 of file ResourceStorage.php.

References ResourceInterface\getIdentifier(), and ResourceStorage\hashFileByIdentifier().

hashFileByIdentifier (   $fileIdentifier,
  $hash 
)

Creates a (cryptographic) hash for a fileIdentifier.

Parameters
string$fileIdentifier
string$hash
Returns
string

Definition at line 1251 of file ResourceStorage.php.

Referenced by ResourceStorage\hashFile().

isBrowsable ( )

Returns TRUE if this storage is browsable by a (backend) user of TYPO3.

Returns
bool

Definition at line 338 of file ResourceStorage.php.

References ResourceStorage\hasCapability(), and ResourceStorage\isOnline().

Referenced by ResourceStorage\checkFolderActionPermission(), and FormPersistenceManager\getStorageByUid().

isDefault ( )
Returns
bool

Definition at line 3019 of file ResourceStorage.php.

References ResourceStorage\$isDefault.

Referenced by ResourceStorage\__construct(), and ResourceStorage\setDefault().

isProcessingFolder ( Folder  $folder)

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

Parameters
Folder$folder
Returns
bool

Definition at line 1608 of file ResourceStorage.php.

References ResourceStorage\$processingFolder, and Folder\getCombinedIdentifier().

Referenced by ResourceStorage\getRole().

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 317 of file ResourceStorage.php.

References ResourceStorage\hasCapability().

isWithinFolder ( Folder  $folder,
ResourceInterface  $resource 
)

Checks if a resource (file or folder) is within the given folder

Parameters
Folder$folder
ResourceInterface$resource
Returns
bool
Exceptions
InvalidArgumentException

Definition at line 2393 of file ResourceStorage.php.

References ResourceInterface\getIdentifier(), Folder\getIdentifier(), ResourceInterface\getStorage(), and Folder\getStorage().

Referenced by ResourceStorage\copyFolder(), and ResourceStorage\moveFolder().

isWithinProcessingFolder (   $identifier)

Returns TRUE if the specified file is in a folder that is set a processing for a storage

Parameters
string$identifier
Returns
bool

Definition at line 2373 of file ResourceStorage.php.

References ResourceStorage\$processingFolder.

Referenced by ResourceStorage\hasFile().

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 328 of file ResourceStorage.php.

References ResourceStorage\hasCapability().

Referenced by ResourceStorage\checkFileActionPermission(), ResourceStorage\checkFolderActionPermission(), and Import\isEquivalentObjectStorage().

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.

Returns
void

Definition at line 406 of file ResourceStorage.php.

References ResourceStorage\getUid(), ResourceStorage\isOnline(), and GeneralUtility\makeInstance().

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.

Returns
void

Definition at line 430 of file ResourceStorage.php.

References ResourceStorage\getUid(), ResourceStorage\isOnline(), and GeneralUtility\makeInstance().

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 ::func_move()

Parameters
FileInterface$file
Folder$targetFolder
string$targetFileNamean optional destination fileName
string$conflictModea value of the DuplicationBehavior enumeration
Exceptions
ExceptionExistingTargetFileNameException
RuntimeException
Returns
FileInterface

Definition at line 1815 of file ResourceStorage.php.

References ResourceStorage\assureFileMovePermissions(), DuplicationBehavior\CANCEL, Enumeration\cast(), ResourceStorage\emitPostFileMoveSignal(), ResourceStorage\emitPreFileMoveSignal(), ResourceStorage\getIndexer(), ResourceStorage\getUid(), ResourceStorage\getUniqueName(), and DuplicationBehavior\RENAME.

moveFolder ( Folder  $folderToMove,
Folder  $targetParentFolder,
  $newFolderName = null,
  $conflictMode = DuplicationBehavior::RENAME 
)

Moves a folder. If you want to move a folder from this storage to another one, call this method on the target storage, otherwise you will get an exception.

Parameters
Folder$folderToMoveThe folder to move.
Folder$targetParentFolderThe target parent folder
string$newFolderName
string$conflictModea value of the DuplicationBehavior enumeration
Exceptions
Exception|
InvalidArgumentException
InvalidTargetFolderException
Returns
Folder

Definition at line 2002 of file ResourceStorage.php.

References ResourceStorage\assureFolderMovePermissions(), ResourceStorage\emitPostFolderMoveSignal(), ResourceStorage\emitPreFolderMoveSignal(), ResourceStorage\getFolder(), Folder\getIdentifier(), ResourceStorage\getIndexer(), Folder\getName(), Folder\getParentFolder(), Folder\getStorage(), ResourceStorage\getUid(), ResourceStorage\isWithinFolder(), and ResourceStorage\moveFolderBetweenStorages().

moveFolderBetweenStorages ( Folder  $folderToMove,
Folder  $targetParentFolder,
  $newFolderName 
)
protected

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

Parameters
Folder$folderToMove
Folder$targetParentFolder
string$newFolderName
Returns
bool
Exceptions
RuntimeException

Definition at line 2050 of file ResourceStorage.php.

Referenced by ResourceStorage\moveFolder().

processFile ( FileInterface  $fileObject,
  $context,
array  $configuration 
)

Passes a file to the File Processing Services and returns the resulting ProcessedFile object.

Parameters
FileInterface$fileObjectThe file object
string$context
array$configuration
Returns
ProcessedFile
Exceptions
InvalidArgumentException

Definition at line 1341 of file ResourceStorage.php.

References ResourceStorage\getFileProcessingService(), and ResourceInterface\getStorage().

renameFile (   $file,
  $targetFileName 
)

Previously in ::func_rename()

Parameters
FileInterface$file
string$targetFileName
Exceptions
ExceptionInsufficientFileWritePermissionsException
ExceptionInsufficientFileReadPermissionsException
ExceptionInsufficientUserPermissionsException
Returns
FileInterface

Definition at line 1869 of file ResourceStorage.php.

References ResourceStorage\assureFileRenamePermissions(), ResourceStorage\emitPostFileRenameSignal(), ResourceStorage\emitPreFileRenameSignal(), and ResourceStorage\getIndexer().

renameFolder (   $folderObject,
  $newName 
)

Previously in ::folder_move()

Parameters
Folder$folderObject
string$newName
Exceptions
Exception
InvalidArgumentException
Returns
Folder

Definition at line 2121 of file ResourceStorage.php.

References ResourceStorage\checkFolderActionPermission(), ResourceStorage\emitPostFolderRenameSignal(), ResourceStorage\emitPreFolderRenameSignal(), ResourceStorage\getFolder(), and ResourceStorage\getIndexer().

replaceFile ( FileInterface  $file,
  $localFilePath 
)
resetFileAndFolderNameFiltersToDefault ( )

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

Returns
void

Definition at line 1419 of file ResourceStorage.php.

References $GLOBALS.

Referenced by ResourceStorage\__construct().

sanitizeFileName (   $fileName,
Folder  $targetFolder = null 
)

Clean a fileName from not allowed characters

Parameters
string$fileNameThe name of the file to be add, If not set, the local file name is used
Folder$targetFolderThe target folder where the file should be added
Exceptions
InvalidArgumentException
ExceptionExistingTargetFileNameException
Returns
FileInterface

Definition at line 1147 of file ResourceStorage.php.

References ResourceStorage\emitSanitizeFileNameSignal(), and ResourceStorage\getDefaultFolder().

Referenced by ResourceStorage\addFile().

setConfiguration ( array  $configuration)

Sets the configuration.

Parameters
array$configuration

Definition at line 217 of file ResourceStorage.php.

References ResourceStorage\$configuration.

setDefault (   $isDefault)
Parameters
bool$isDefault
Returns
void

Definition at line 3011 of file ResourceStorage.php.

References ResourceStorage\$isDefault, and ResourceStorage\isDefault().

setDriver ( Driver\DriverInterface  $driver)

Sets the storage that belongs to this storage.

Parameters
Driver\DriverInterface$driver
Returns
ResourceStorage

Definition at line 238 of file ResourceStorage.php.

References ResourceStorage\$driver.

setEvaluatePermissions (   $evaluatePermissions)

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

Parameters
bool$evaluatePermissions

Definition at line 546 of file ResourceStorage.php.

References ResourceStorage\$evaluatePermissions.

Referenced by StoragePermissionsAspect\addUserPermissionsToStorage().

setFileAndFolderNameFilters ( array  $filters)
Parameters
array$filters
Returns
$this

Definition at line 1438 of file ResourceStorage.php.

setFileContents ( AbstractFile  $file,
  $contents 
)

Set contents of a file object.

Parameters
AbstractFile$file
string$contents
Exceptions
Exception|
ExceptionInsufficientFileWritePermissionsException
ExceptionInsufficientUserPermissionsException
Returns
int The number of bytes written to the file

Definition at line 1692 of file ResourceStorage.php.

References ResourceStorage\assureFileWritePermissions(), ResourceStorage\emitPostFileSetContentsSignal(), AbstractFile\getIdentifier(), and ResourceStorage\getIndexer().

setUserPermissions ( array  $userPermissions)

Sets the user permissions of the storage.

Parameters
array$userPermissions
Returns
void

Definition at line 568 of file ResourceStorage.php.

References ResourceStorage\$userPermissions.

Referenced by StoragePermissionsAspect\addUserPermissionsToStorage().

unsetFileAndFolderNameFilters ( )

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

Returns
void

Definition at line 1409 of file ResourceStorage.php.

updateProcessedFile (   $localFilePath,
ProcessedFile  $processedFile,
Folder  $processingFolder = null 
)

Updates a processed file with a new file from the local filesystem.

Parameters
string$localFilePath
ProcessedFile$processedFile
Folder$processingFolder
Returns
FileInterface
Exceptions
InvalidArgumentException

Definition at line 1217 of file ResourceStorage.php.

References ResourceStorage\$processingFolder, ProcessedFile\getName(), ProcessedFile\getOriginalFile(), ResourceStorage\getProcessingFolder(), and AbstractFile\setIdentifier().

usesCaseSensitiveIdentifiers ( )

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

Returns
bool

Definition at line 348 of file ResourceStorage.php.

Member Data Documentation

$capabilities
protected

Definition at line 119 of file ResourceStorage.php.

Referenced by ResourceStorage\getCapabilities().

$configuration
protected
$driver
protected
$evaluatePermissions = false
protected
$fileAndFolderNameFilters = []
protected

Definition at line 155 of file ResourceStorage.php.

Referenced by ResourceStorage\getFileAndFolderNameFilters().

$fileMounts = []
protected

Definition at line 103 of file ResourceStorage.php.

Referenced by ResourceStorage\getFileMounts().

$fileProcessingService
protected

Definition at line 86 of file ResourceStorage.php.

Referenced by ResourceStorage\getFileProcessingService().

$isDefault = false
protected

Definition at line 148 of file ResourceStorage.php.

Referenced by ResourceStorage\isDefault(), and ResourceStorage\setDefault().

$isOnline = null
protected

Definition at line 143 of file ResourceStorage.php.

Referenced by ResourceStorage\isOnline().

$processingFolders
protected

Definition at line 136 of file ResourceStorage.php.

$signalSlotDispatcher
protected

Definition at line 124 of file ResourceStorage.php.

Referenced by ResourceStorage\getSignalSlotDispatcher().

$storageRecord
protected
$userPermissions = []
protected

Definition at line 111 of file ResourceStorage.php.

Referenced by ResourceStorage\setUserPermissions().

const PROCESSING_FOLDER_LEVELS = 2

Levels numbers used to generate hashed subfolders in the processing folder

Definition at line 160 of file ResourceStorage.php.

Referenced by ResourceStorageTest\getNestedProcessingFolderTest().