TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
File Class Reference
Inheritance diagram for File:
AbstractFile FileInterface ResourceInterface

Public Member Functions

 __construct (array $fileData, ResourceStorage $storage, array $metaData=array())
 
 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 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)
 
 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 = array()
 
 $indexingInProgress = false
 
 $updatedProperties = array()
 
- Protected Attributes inherited from AbstractFile
 $properties
 
 $storage = null
 
 $identifier
 
 $name
 
 $deleted = false
 

Additional Inherited Members

- Public Attributes inherited from 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 23 of file core/Classes/Resource/File.php.

Constructor & Destructor Documentation

__construct ( array  $fileData,
ResourceStorage  $storage,
array  $metaData = array() 
)

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 58 of file core/Classes/Resource/File.php.

References AbstractFile\$storage.

Member Function Documentation

_getMetaData ( )
_getPropertyRaw (   $key)
Parameters
$key

Definition at line 409 of file core/Classes/Resource/File.php.

Referenced by FileIndexRepository\add(), and FileIndexRepository\getWhereClauseForFile().

_updateMetaDataProperties ( array  $properties)

Updates MetaData properties

Definition at line 248 of file core/Classes/Resource/File.php.

Referenced by Indexer\extractMetaData(), and Indexer\extractRequiredMetaData().

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 287 of file core/Classes/Resource/File.php.

References $GLOBALS, AbstractFile\getCombinedIdentifier(), and AbstractFile\getMimeType().

Referenced by File\toArray().

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 272 of file core/Classes/Resource/File.php.

References AbstractFile\getStorage().

Referenced by FileList\linkWrapFile(), FileList\makeEdit(), and File\toArray().

getContents ( )

Get the contents of this file

Returns
string File contents

Implements FileInterface.

Definition at line 137 of file core/Classes/Resource/File.php.

References AbstractFile\getStorage().

Referenced by AbstractOnlineMediaHelper\getOnlineMediaId().

getFileIndexRepository ( )
protected
Returns

Definition at line 390 of file core/Classes/Resource/File.php.

References GeneralUtility\makeInstance().

getMetaDataRepository ( )
protected
Returns

Definition at line 382 of file core/Classes/Resource/File.php.

References GeneralUtility\makeInstance().

Referenced by File\loadMetaData().

getProperties ( )

Returns the properties of this object.

Returns
array

Definition at line 110 of file core/Classes/Resource/File.php.

References File\_getMetaData().

Referenced by FileIndexRepository\add(), and FileIndexRepository\update().

getProperty (   $key)

Returns a property value

Parameters
string$key
Returns
mixed Property value

Implements FileInterface.

Definition at line 79 of file core/Classes/Resource/File.php.

References File\_getMetaData().

Referenced by AbstractOEmbedHelper\getMetaData(), SelectImage\insertPlainImage(), File\isMissing(), and FileIndexRepository\update().

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

Implements FileInterface.

Definition at line 370 of file core/Classes/Resource/File.php.

References AbstractFile\getStorage(), and File\isMissing().

Referenced by SelectImage\insertPlainImage(), and File\toArray().

getSha1 ( )

Gets SHA1 hash.

Returns
string

Implements FileInterface.

Definition at line 147 of file core/Classes/Resource/File.php.

getUpdatedProperties ( )

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

Returns
array

Definition at line 258 of file core/Classes/Resource/File.php.

References File\$updatedProperties.

Referenced by FileIndexRepository\update().

hasProperty (   $key)

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

Parameters
string$key
Returns
bool

Implements FileInterface.

Definition at line 96 of file core/Classes/Resource/File.php.

References File\_getMetaData().

isIndexed ( )

Returns TRUE if this file is indexed

Returns
bool|NULL

Implements FileInterface.

Definition at line 175 of file core/Classes/Resource/File.php.

Referenced by FileList\linkWrapFile().

isMissing ( )
Returns
bool

Definition at line 346 of file core/Classes/Resource/File.php.

References File\getProperty().

Referenced by File\getPublicUrl().

loadMetaData ( )
protected

Loads MetaData from Repository

Returns
void

Definition at line 184 of file core/Classes/Resource/File.php.

References File\getMetaDataRepository().

Referenced by File\_getMetaData().

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 303 of file core/Classes/Resource/File.php.

References AbstractFile\getStorage().

Referenced by ImageManipulationElement\getPreview().

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

Definition at line 161 of file core/Classes/Resource/File.php.

References AbstractFile\getStorage().

setIndexingInProgess (   $indexingState)
Returns
void

Definition at line 399 of file core/Classes/Resource/File.php.

setMissing (   $missing)
Parameters
bool$missing

Definition at line 354 of file core/Classes/Resource/File.php.

References File\updateProperties().

toArray ( )

Returns an array representation of the file. (This is used by the generic listing module vidi when displaying file records.)

Returns
array Array of main data of the file. Don't rely on all data to be present here, it's just a selection of the most relevant information.

Implements FileInterface.

Definition at line 314 of file core/Classes/Resource/File.php.

References File\calculateChecksum(), File\checkActionPermission(), AbstractFile\getCombinedIdentifier(), AbstractFile\getExtension(), AbstractFile\getMimeType(), AbstractFile\getName(), File\getPublicUrl(), AbstractFile\getSize(), AbstractFile\getStorage(), AbstractFile\getType(), and AbstractFile\getUid().

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

Definition at line 206 of file core/Classes/Resource/File.php.

References ResourceFactory\getInstance(), and AbstractFile\getType().

Referenced by FileIndexRepository\add(), File\setMissing(), and Indexer\updateIndexEntry().

Member Data Documentation

$indexingInProgress = false
protected

Definition at line 40 of file core/Classes/Resource/File.php.

$metaDataLoaded = false
protected

Definition at line 28 of file core/Classes/Resource/File.php.

$metaDataProperties = array()
protected

Definition at line 33 of file core/Classes/Resource/File.php.

Referenced by File\_getMetaData().

$updatedProperties = array()
protected

Definition at line 48 of file core/Classes/Resource/File.php.

Referenced by File\getUpdatedProperties().