InaccessibleFolder

class \TYPO3\CMS\Core\Resource\InaccessibleFolder

Extends
Folder

A representation for an inaccessible folder.

If a folder has execution rights you can list its contents despite the access rights on the subfolders. If a subfolder has no rights it has to be shown anyhow, but marked as inaccessible.

Table of Contents

Constants

FILTER_MODE_NO_FILTERS  : mixed = 0
Modes for filter usage in getFiles()/getFolders()
FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS  : mixed = 1
FILTER_MODE_USE_OWN_FILTERS  : mixed = 3
FILTER_MODE_USE_STORAGE_FILTERS  : mixed = 2

Properties

$fileAndFolderNameFilters  : callable[]
The filters this folder should use for a filelist.
$identifier  : string
The identifier of this folder to identify it on the storage.
$name  : string
The name of this folder
$storage  : ResourceStorage
The storage this folder belongs to.

Methods

__construct()  : mixed
addFile()  : never
Adds a file from the local server disk. If the file already exists and overwriting is disabled,
addUploadedFile()  : never
Adds an uploaded file into the Storage.
checkActionPermission()  : bool
Check if a file operation (= action) is allowed on this folder
copyTo()  : Folder
Copies folder to a target folder
createFile()  : File
Creates a new blank file
createFolder()  : never
Creates a new folder
delete()  : never
Deletes this folder from its storage. This also means that this object becomes useless.
getCombinedIdentifier()  : string
Returns a combined identifier of this folder, i.e. the storage UID and the folder identifier separated by a colon ":".
getCreationTime()  : int
Returns the creation time of the file as Unix timestamp
getFile()  : FileInterface|null
Fetches a file from a folder, must be a direct descendant of a folder.
getFileCount()  : never
Returns amount of all files within this folder, optionally filtered by the given pattern
getFiles()  : File[]
Returns a list of files in this folder, optionally filtered. There are several filter modes available, see the FILTER_MODE_* constants for more information.
getHashedIdentifier()  : non-empty-string
getIdentifier()  : non-empty-string
Returns the path of this folder inside the storage. It depends on the type of storage whether this is a real path or just some unique identifier.
getModificationTime()  : int
Returns the modification time of the file as Unix timestamp
getName()  : string
getParentFolder()  : Folder
Returns the parent folder.
getPublicUrl()  : string|null
Returns a publicly accessible URL for this folder
getReadablePath()  : string
Returns the full path of this folder, from the root.
getRole()  : string
Returns the role of this folder (if any). See FolderInterface::ROLE_* constants for possible values.
getStorage()  : ResourceStorage
getSubfolder()  : never
Returns the object for a subfolder of the current folder if it exists, or throws a FolderDoesNotExistException.
getSubfolders()  : array<string|int, Folder>
hasFile()  : never
Checks if a file exists in this folder
hasFolder()  : never
Checks if a folder exists in this folder.
moveTo()  : Folder
Moves folder to a target folder
rename()  : never
Renames this folder.
searchFiles()  : FileSearchResultInterface
Returns a file search result based on the given demand.
setFileAndFolderNameFilters()  : never
Sets the filters to use when listing files. These are only used if the filter mode is one of FILTER_MODE_USE_OWN_FILTERS and FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS
setName()  : never
Sets a new name of the folder currently this does not trigger the "renaming process" as the name is more seen as a label
updateProperties()  : never
Updates the properties of this folder, e.g. after re-indexing or moving it.
prepareFiltersInStorage()  : array
Prepares the filters in this folder's storage according to a set filter mode.
restoreBackedUpFiltersInStorage()  : void
Restores the filters of a storage.
throwInaccessibleException()  : never
Throws an Exception, used to prevent duplicate code in all the methods

Constants

FILTER_MODE_NO_FILTERS

Modes for filter usage in getFiles()/getFolders()

public mixed FILTER_MODE_NO_FILTERS = 0

FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS

public mixed FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS = 1

FILTER_MODE_USE_OWN_FILTERS

public mixed FILTER_MODE_USE_OWN_FILTERS = 3

FILTER_MODE_USE_STORAGE_FILTERS

public mixed FILTER_MODE_USE_STORAGE_FILTERS = 2

Properties

$fileAndFolderNameFilters

The filters this folder should use for a filelist.

protected callable[] $fileAndFolderNameFilters = []

$identifier

The identifier of this folder to identify it on the storage.

protected string $identifier

On some drivers, this is the path to the folder, but drivers could also just provide any other unique identifier for this folder on the specific storage.

$name

The name of this folder

protected string $name

Methods

addUploadedFile()

Adds an uploaded file into the Storage.

public addUploadedFile(array|UploadedFileInterface $uploadedFileData[, DuplicationBehavior $conflictMode = DuplicationBehavior::CANCEL ]) : never

Parameters

$uploadedFileData : array|UploadedFileInterface

Information about the uploaded file given by $_FILES['file1'] or a PSR-7 UploadedFileInterface object

$conflictMode : DuplicationBehavior = DuplicationBehavior::CANCEL

Tags

throws
InsufficientFolderReadPermissionsException

Return values

never

checkActionPermission()

Check if a file operation (= action) is allowed on this folder

public checkActionPermission(string $action) : bool

Parameters

$action : string

Action that can be read, write or delete

Return values

bool

copyTo()

Copies folder to a target folder

public copyTo(Folder $targetFolder[, string|null $targetFolderName = null ][, DuplicationBehavior $conflictMode = DuplicationBehavior::RENAME ]) : Folder

Parameters

$targetFolder : Folder

Target folder to copy to.

$targetFolderName : string|null = null

an optional destination fileName

$conflictMode : DuplicationBehavior = DuplicationBehavior::RENAME

Tags

throws
InsufficientFolderReadPermissionsException

Return values

Folder —

New (copied) folder object.

delete()

Deletes this folder from its storage. This also means that this object becomes useless.

public delete([bool $deleteRecursively = true ]) : never

Parameters

$deleteRecursively : bool = true

Tags

throws
InsufficientFolderReadPermissionsException

Return values

never

getCombinedIdentifier()

Returns a combined identifier of this folder, i.e. the storage UID and the folder identifier separated by a colon ":".

public getCombinedIdentifier() : string

Return values

string —

Combined storage and folder identifier, e.g. StorageUID:folder/path/

getCreationTime()

Returns the creation time of the file as Unix timestamp

public getCreationTime() : int

Return values

int

getFile()

Fetches a file from a folder, must be a direct descendant of a folder.

public getFile(string $fileName) : FileInterface|null

Parameters

$fileName : string

Return values

FileInterface|null

getFileCount()

Returns amount of all files within this folder, optionally filtered by the given pattern

public getFileCount([array $filterMethods = [] ][, bool $recursive = false ]) : never

Parameters

$filterMethods : array = []
$recursive : bool = false

Tags

throws
InsufficientFolderReadPermissionsException

Return values

never

getFiles()

Returns a list of files in this folder, optionally filtered. There are several filter modes available, see the FILTER_MODE_* constants for more information.

public getFiles([int $start = 0 ][, int $numberOfItems = 0 ][, int $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS ][, bool $recursive = false ][, string $sort = '' ][, bool $sortRev = false ]) : File[]

Parameters

$start : int = 0

The item to start at

$numberOfItems : int = 0

The number of items to return

$filterMode : int = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS

The filter mode to use for the filelist.

$recursive : bool = false
$sort : string = ''

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".

$sortRev : bool = false

TRUE to indicate reverse sorting (last to first)

Tags

throws
InsufficientFolderReadPermissionsException

Return values

File[]

getHashedIdentifier()

public getHashedIdentifier() : non-empty-string

Return values

non-empty-string

getIdentifier()

Returns the path of this folder inside the storage. It depends on the type of storage whether this is a real path or just some unique identifier.

public getIdentifier() : non-empty-string

Return values

non-empty-string

getModificationTime()

Returns the modification time of the file as Unix timestamp

public getModificationTime() : int

Return values

int

getName()

public getName() : string

Return values

string

getReadablePath()

Returns the full path of this folder, from the root.

public getReadablePath([string|null $rootId = null ]) : string

Parameters

$rootId : string|null = null

ID of the root folder, NULL to auto-detect

Return values

string

getRole()

Returns the role of this folder (if any). See FolderInterface::ROLE_* constants for possible values.

public getRole() : string

Return values

string

getSubfolder()

Returns the object for a subfolder of the current folder if it exists, or throws a FolderDoesNotExistException.

public getSubfolder(string $name) : never

Parameters

$name : string

Tags

throws
InsufficientFolderReadPermissionsException

Return values

never

getSubfolders()

public getSubfolders([int $start = 0 ][, int $numberOfItems = 0 ][, int $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS ][, bool $recursive = false ]) : array<string|int, Folder>

Parameters

$start : int = 0

The item to start at

$numberOfItems : int = 0

The number of items to return

$filterMode : int = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS

The filter mode to use for the filelist.

$recursive : bool = false

Tags

throws
InsufficientFolderReadPermissionsException

Return values

array<string|int, Folder>

moveTo()

Moves folder to a target folder

public moveTo(Folder $targetFolder[, string|null $targetFolderName = null ][, DuplicationBehavior $conflictMode = DuplicationBehavior::RENAME ]) : Folder

Parameters

$targetFolder : Folder

Target folder to move to.

$targetFolderName : string|null = null

an optional destination fileName

$conflictMode : DuplicationBehavior = DuplicationBehavior::RENAME

Tags

throws
InsufficientFolderReadPermissionsException

Return values

Folder —

New (copied) folder object.

searchFiles()

Returns a file search result based on the given demand.

public searchFiles(FileSearchDemand $searchDemand[, int $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS ]) : FileSearchResultInterface

The result also includes matches in meta-data fields that are defined in TCA.

Parameters

$searchDemand : FileSearchDemand
$filterMode : int = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS

The filter mode to use for the found files

Return values

FileSearchResultInterface

setFileAndFolderNameFilters()

Sets the filters to use when listing files. These are only used if the filter mode is one of FILTER_MODE_USE_OWN_FILTERS and FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS

public setFileAndFolderNameFilters(array $filters) : never

Parameters

$filters : array

Return values

never

setName()

Sets a new name of the folder currently this does not trigger the "renaming process" as the name is more seen as a label

public setName(string $name) : never

Parameters

$name : string

The new name

Tags

throws
InsufficientFolderReadPermissionsException

Return values

never

updateProperties()

Updates the properties of this folder, e.g. after re-indexing or moving it.

public updateProperties(array $properties) : never

Parameters

$properties : array

Return values

never

prepareFiltersInStorage()

Prepares the filters in this folder's storage according to a set filter mode.

protected prepareFiltersInStorage(int $filterMode) : array

Parameters

$filterMode : int

The filter mode to use; one of the FILTER_MODE_* constants

Return values

array —

The backed up filters as an array (NULL if filters were not backed up) and whether to use filters or not (bool)

restoreBackedUpFiltersInStorage()

Restores the filters of a storage.

protected restoreBackedUpFiltersInStorage(array|null $backedUpFilters) : void

Parameters

$backedUpFilters : array|null

The filters to restore; might be NULL if no filters have been backed up, in which case this method does nothing.

Tags

see
prepareFiltersInStorage()
On this page