TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Core\Resource\File Class Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\File:
TYPO3\CMS\Core\Resource\AbstractFile TYPO3\CMS\Core\Resource\FileInterface TYPO3\CMS\Core\Resource\ResourceInterface

Public Member Functions

 __construct (array $fileData, ResourceStorage $storage, array $metaData=[])
 
 getProperty ($key)
 
 hasProperty ($key)
 
 getProperties ()
 
 _getMetaData ()
 
 getContents ()
 
 getSha1 ()
 
 setContents ($contents)
 
 isIndexed ()
 
 updateProperties (array $properties)
 
 _updateMetaDataProperties (array $properties)
 
 getUpdatedProperties ()
 
 checkActionPermission ($action)
 
 calculateChecksum ()
 
 process ($taskType, array $configuration)
 
 toArray ()
 
 isMissing ()
 
 setMissing ($missing)
 
 getPublicUrl ($relativeToCurrentScript=false)
 
 setIndexingInProgess ($indexingState)
 
 _getPropertyRaw ($key)
 
- Public Member Functions inherited from TYPO3\CMS\Core\Resource\AbstractFile
 hasProperty ($key)
 
 getProperty ($key)
 
 getProperties ()
 
 getIdentifier ()
 
 getHashedIdentifier ()
 
 getName ()
 
 getNameWithoutExtension ()
 
 getSize ()
 
 getUid ()
 
 getSha1 ()
 
 getCreationTime ()
 
 getModificationTime ()
 
 getExtension ()
 
 getMimeType ()
 
 getType ()
 
 getContents ()
 
 setContents ($contents)
 
 getStorage ()
 
 exists ()
 
 setStorage (ResourceStorage $storage)
 
 setIdentifier ($identifier)
 
 getCombinedIdentifier ()
 
 delete ()
 
 setDeleted ()
 
 isDeleted ()
 
 rename ($newName, $conflictMode=DuplicationBehavior::RENAME)
 
 copyTo (Folder $targetFolder, $targetFileName=null, $conflictMode=DuplicationBehavior::RENAME)
 
 moveTo (Folder $targetFolder, $targetFileName=null, $conflictMode=DuplicationBehavior::RENAME)
 
 getPublicUrl ($relativeToCurrentScript=false)
 
 getForLocalProcessing ($writable=true)
 
 updateProperties (array $properties)
 
 getParentFolder ()
 

Protected Member Functions

 loadMetaData ()
 
 getMetaDataRepository ()
 
 getFileIndexRepository ()
 

Protected Attributes

 $metaDataLoaded = false
 
 $metaDataProperties = []
 
 $indexingInProgress = false
 
 $updatedProperties = []
 
- Protected Attributes inherited from TYPO3\CMS\Core\Resource\AbstractFile
 $properties
 
 $storage = null
 
 $identifier
 
 $name
 
 $deleted = false
 

Additional Inherited Members

- Public Attributes inherited from TYPO3\CMS\Core\Resource\AbstractFile
const FILETYPE_UNKNOWN = 0
 
const FILETYPE_TEXT = 1
 
const FILETYPE_IMAGE = 2
 
const FILETYPE_AUDIO = 3
 
const FILETYPE_VIDEO = 4
 
const FILETYPE_APPLICATION = 5
 

Detailed Description

File representation in the file abstraction layer.

Definition at line 22 of file File.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Resource\File::__construct ( array  $fileData,
ResourceStorage  $storage,
array  $metaData = [] 
)

Constructor for a file object. Should normally not be used directly, use the corresponding factory methods instead.

Parameters
array$fileData
ResourceStorage$storage
array$metaData

Definition at line 57 of file File.php.

References TYPO3\CMS\Core\Resource\AbstractFile\$storage.

Member Function Documentation

◆ _getMetaData()

◆ _getPropertyRaw()

TYPO3\CMS\Core\Resource\File::_getPropertyRaw (   $key)

◆ _updateMetaDataProperties()

TYPO3\CMS\Core\Resource\File::_updateMetaDataProperties ( array  $properties)

◆ calculateChecksum()

TYPO3\CMS\Core\Resource\File::calculateChecksum ( )

Creates a MD5 hash checksum based on the combined identifier of the file, the files' mimetype and the systems' encryption key. used to generate a thumbnail, and this hash is checked if valid

Returns
string the MD5 hash

Definition at line 281 of file File.php.

References $GLOBALS, TYPO3\CMS\Core\Resource\AbstractFile\getCombinedIdentifier(), and TYPO3\CMS\Core\Resource\AbstractFile\getMimeType().

Referenced by TYPO3\CMS\Core\Resource\File\toArray().

◆ checkActionPermission()

TYPO3\CMS\Core\Resource\File::checkActionPermission (   $action)

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

Parameters
string$action,canbe read, write, delete
Returns
bool

Definition at line 266 of file File.php.

References TYPO3\CMS\Core\Resource\AbstractFile\getStorage().

Referenced by TYPO3\CMS\Impexp\Export\export_addSysFile(), TYPO3\CMS\Filelist\FileList\linkWrapFile(), and TYPO3\CMS\Core\Resource\File\toArray().

◆ getContents()

◆ getFileIndexRepository()

TYPO3\CMS\Core\Resource\File::getFileIndexRepository ( )
protected
Returns
Index

Definition at line 383 of file File.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getMetaDataRepository()

TYPO3\CMS\Core\Resource\File::getMetaDataRepository ( )
protected

◆ getProperties()

TYPO3\CMS\Core\Resource\File::getProperties ( )

◆ getProperty()

◆ getPublicUrl()

TYPO3\CMS\Core\Resource\File::getPublicUrl (   $relativeToCurrentScript = false)

Returns a publicly accessible URL for this file When file is marked as missing or deleted no url is returned

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
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|null NULL if file is missing or deleted, the generated url otherwise

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 364 of file File.php.

References TYPO3\CMS\Core\Resource\AbstractFile\getStorage(), and TYPO3\CMS\Core\Resource\File\isMissing().

Referenced by TYPO3\CMS\Impexp\Export\export_addSysFile(), and TYPO3\CMS\Core\Resource\File\toArray().

◆ getSha1()

TYPO3\CMS\Core\Resource\File::getSha1 ( )

Gets SHA1 hash.

Returns
string

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 144 of file File.php.

◆ getUpdatedProperties()

TYPO3\CMS\Core\Resource\File::getUpdatedProperties ( )

Returns the names of all properties that have been updated in this record

Returns
array

Definition at line 252 of file File.php.

References TYPO3\CMS\Core\Resource\File\$updatedProperties.

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

◆ hasProperty()

TYPO3\CMS\Core\Resource\File::hasProperty (   $key)

Checks if the file has a (metadata) property which can be retrieved by "getProperty"

Parameters
string$key
Returns
bool

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 94 of file File.php.

References TYPO3\CMS\Core\Resource\File\_getMetaData().

◆ isIndexed()

TYPO3\CMS\Core\Resource\File::isIndexed ( )

Returns TRUE if this file is indexed

Returns
bool|null

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 172 of file File.php.

Referenced by TYPO3\CMS\Filelist\FileList\linkWrapFile().

◆ isMissing()

TYPO3\CMS\Core\Resource\File::isMissing ( )
Returns
bool

Definition at line 340 of file File.php.

References TYPO3\CMS\Core\Resource\File\getProperty().

Referenced by TYPO3\CMS\Core\Resource\File\getPublicUrl().

◆ loadMetaData()

TYPO3\CMS\Core\Resource\File::loadMetaData ( )
protected

Loads MetaData from Repository

Definition at line 180 of file File.php.

References TYPO3\CMS\Core\Resource\File\getMetaDataRepository().

Referenced by TYPO3\CMS\Core\Resource\File\_getMetaData().

◆ process()

TYPO3\CMS\Core\Resource\File::process (   $taskType,
array  $configuration 
)

Returns a modified version of the file.

Parameters
string$taskTypeThe task type of this processing
array$configurationthe processing configuration, see manual for that
Returns
ProcessedFile The processed file

Definition at line 297 of file File.php.

References TYPO3\CMS\Core\Resource\AbstractFile\getStorage().

◆ setContents()

TYPO3\CMS\Core\Resource\File::setContents (   $contents)

Replace the current file contents with the given string

Parameters
string$contentsThe contents to write to the file.
Returns
File The file object (allows chaining).

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 158 of file File.php.

References TYPO3\CMS\Core\Resource\AbstractFile\getStorage().

◆ setIndexingInProgess()

TYPO3\CMS\Core\Resource\File::setIndexingInProgess (   $indexingState)
Parameters
bool$indexingState

Definition at line 392 of file File.php.

◆ setMissing()

TYPO3\CMS\Core\Resource\File::setMissing (   $missing)
Parameters
bool$missing

Definition at line 348 of file File.php.

References TYPO3\CMS\Core\Resource\File\updateProperties().

◆ toArray()

TYPO3\CMS\Core\Resource\File::toArray ( )

◆ updateProperties()

TYPO3\CMS\Core\Resource\File::updateProperties ( array  $properties)

Updates the properties of this file, e.g. after re-indexing or moving it. By default, only properties that exist as a key in the $properties array are overwritten. If you want to explicitly unset a property, set the corresponding key to NULL in the array.

NOTE: This method should not be called from outside the File Abstraction Layer (FAL)!

Parameters
array$properties

Definition at line 201 of file File.php.

References TYPO3\CMS\Core\Resource\ResourceFactory\getInstance(), and TYPO3\CMS\Core\Resource\AbstractFile\getType().

Referenced by TYPO3\CMS\Core\Resource\Index\FileIndexRepository\add(), TYPO3\CMS\Core\Resource\File\setMissing(), and TYPO3\CMS\Core\Resource\Index\Indexer\updateIndexEntry().

Member Data Documentation

◆ $indexingInProgress

TYPO3\CMS\Core\Resource\File::$indexingInProgress = false
protected

Definition at line 39 of file File.php.

◆ $metaDataLoaded

TYPO3\CMS\Core\Resource\File::$metaDataLoaded = false
protected

Definition at line 27 of file File.php.

◆ $metaDataProperties

TYPO3\CMS\Core\Resource\File::$metaDataProperties = []
protected

Definition at line 32 of file File.php.

Referenced by TYPO3\CMS\Core\Resource\File\_getMetaData().

◆ $updatedProperties

TYPO3\CMS\Core\Resource\File::$updatedProperties = []
protected

Definition at line 47 of file File.php.

Referenced by TYPO3\CMS\Core\Resource\File\getUpdatedProperties().