TYPO3 CMS  TYPO3_6-2
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, $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 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)
 
 copyTo (Folder $targetFolder, $targetFileName=NULL, $conflictMode='renameNewFile')
 
 moveTo (Folder $targetFolder, $targetFileName=NULL, $conflictMode='renameNewFile')
 
 getPublicUrl ($relativeToCurrentScript=FALSE)
 
 getForLocalProcessing ($writable=TRUE)
 
 updateProperties (array $properties)
 
 getParentFolder ()
 

Protected Member Functions

 loadMetaData ()
 
 getMetaDataRepository ()
 
 getFileIndexRepository ()
 
 getIndexerService ()
 

Protected Attributes

 $metaDataLoaded = FALSE
 
 $metaDataProperties = array()
 
 $indexingInProgress = FALSE
 
 $updatedProperties = array()
 
 $indexerService = NULL
 
- 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
 
const FILETYPE_SOFTWARE = 5
 

Detailed Description

File representation in the file abstraction layer.

Definition at line 23 of file File.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Resource\File::__construct ( array  $fileData,
ResourceStorage  $storage,
  $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 63 of file File.php.

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

Member Function Documentation

◆ _getMetaData()

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

◆ _getPropertyRaw()

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

◆ _updateMetaDataProperties()

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

Updates MetaData properties

Definition at line 251 of file File.php.

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

Referenced by TYPO3\CMS\Core\Resource\Index\Indexer\extractRequiredMetaData().

◆ 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 291 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
boolean

Definition at line 277 of file File.php.

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

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

◆ getContents()

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

Get the contents of this file

Returns
string File contents

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 145 of file File.php.

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

◆ getFileIndexRepository()

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

Definition at line 387 of file File.php.

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

◆ getIndexerService()

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

Internal function to retrieve the indexer service, if it does not exist, an instance will be created

Returns
Index

Definition at line 397 of file File.php.

References TYPO3\CMS\Core\Resource\File\$indexerService, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getMetaDataRepository()

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

◆ getProperties()

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

Returns the properties of this object.

Returns
array

Definition at line 117 of file File.php.

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

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

◆ getProperty()

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

Returns a property value

Parameters
string$key
Returns
mixed Property value

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 83 of file File.php.

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

Referenced by TYPO3\CMS\Core\Resource\File\isMissing(), and TYPO3\CMS\Core\Resource\Index\FileIndexRepository\update().

◆ 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

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 369 of file File.php.

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

Referenced by 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 154 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 264 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
boolean

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 101 of file File.php.

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

◆ isIndexed()

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

Returns TRUE if this file is indexed

Returns
boolean|NULL

Implements TYPO3\CMS\Core\Resource\FileInterface.

Definition at line 180 of file File.php.

Referenced by TYPO3\CMS\Core\Resource\Service\IndexerService\getFactory().

◆ isMissing()

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

◆ loadMetaData()

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

◆ 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 306 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 167 of file File.php.

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

◆ setIndexingInProgess()

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

Definition at line 408 of file File.php.

Referenced by TYPO3\CMS\Core\Resource\Service\IndexerService\getFactory().

◆ setMissing()

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

Definition at line 354 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
Returns
void

Definition at line 210 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\Service\IndexerService\getFactory(), TYPO3\CMS\Core\Resource\File\setMissing(), and TYPO3\CMS\Core\Resource\Index\Indexer\updateIndexEntry().

Member Data Documentation

◆ $indexerService

TYPO3\CMS\Core\Resource\File::$indexerService = NULL
protected

Definition at line 53 of file File.php.

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

◆ $indexingInProgress

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

Definition at line 40 of file File.php.

◆ $metaDataLoaded

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

Definition at line 28 of file File.php.

◆ $metaDataProperties

TYPO3\CMS\Core\Resource\File::$metaDataProperties = array()
protected

Definition at line 33 of file File.php.

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

◆ $updatedProperties

TYPO3\CMS\Core\Resource\File::$updatedProperties = array()
protected

Definition at line 48 of file File.php.

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