FileNode

class \TYPO3\CMS\Install\FolderStructure\FileNode

Extends
AbstractNode
Implements
NodeInterface

A file

Table of Contents

Interfaces

NodeInterface
Interface for structure nodes root, link, file, .

Properties

$children  : array
$name  : string
$parent  : NodeInterface|null
$targetContent  : string|null
$targetPermission  : string

Methods

__construct()  : mixed
Implement constructor
fix()  : FlashMessage[]
Fix structure
getAbsolutePath()  : string
Get absolute path of node
getName()  : string
Get name
getStatus()  : FlashMessage[]
Get own status Returns warning if file not exists Returns error if file exists but content is not as expected (can / shouldn't be fixed)
isWritable()  : bool
Current node is writable if parent is writable
createFile()  : FlashMessage
Create file if not exists
exists()  : bool
Checks if node exists.
fixPermission()  : FlashMessage
Fix permission if they are not equal to target permission
fixSelf()  : FlashMessage[]
Fix this node: create if not there, fix permissions
getChildren()  : array
Get children
getCurrentPermission()  : string
Get current permission of node
getParent()  : NodeInterface|null
Get parent
getRelativePathBelowSiteRoot()  : string
Cut off project path from given path
getSelfStatus()  : FlashMessage[]
Get status of file
getTargetPermission()  : string
Get target permission
isContentCorrect()  : bool
Compare current file content with target file content
isFile()  : bool
Checks if not is a file
isPermissionCorrect()  : bool
Checks if current permission are identical to target permission
isWindowsOs()  : bool
Returns TRUE if OS is windows
setContent()  : FlashMessage
Sets content of file to target content
setTargetPermission()  : mixed
Set target permission

Properties

$children

protected array $children = []

Directories and root may have children, files and link always empty array

$targetContent

protected string|null $targetContent

Target content of file. If NULL, target content is ignored

$targetPermission

protected string $targetPermission = '0664'

Default for files is octal 0664 == decimal 436

Methods

getAbsolutePath()

Get absolute path of node

public getAbsolutePath() : string

Return values

string

getName()

Get name

public getName() : string

Return values

string —

Name

getStatus()

Get own status Returns warning if file not exists Returns error if file exists but content is not as expected (can / shouldn't be fixed)

public getStatus() : FlashMessage[]

Return values

FlashMessage[]

isWritable()

Current node is writable if parent is writable

public isWritable() : bool

Return values

bool —

TRUE if parent is writable

exists()

Checks if node exists.

protected exists() : bool

Returns TRUE if it is there, even if it is only a link. Does not check the type!

Return values

bool

getChildren()

Get children

protected getChildren() : array

Return values

array

getCurrentPermission()

Get current permission of node

protected getCurrentPermission() : string

Return values

string —

eg. 2775 for dirs, 0664 for files

getRelativePathBelowSiteRoot()

Cut off project path from given path

protected getRelativePathBelowSiteRoot([string $path = null ]) : string

Parameters

$path : string = null

Given path

Tags

throws
InvalidArgumentException

Return values

string —

Relative path, but beginning with /

getTargetPermission()

Get target permission

protected getTargetPermission() : string

Make sure to call octdec on the value when passing this to chmod

Return values

string —

Permissions as a 4 character octal string, i.e. 2775 or 0644

isContentCorrect()

Compare current file content with target file content

protected isContentCorrect() : bool

Tags

throws
Exception

If file does not exist

Return values

bool —

TRUE if current and target file content are identical

isFile()

Checks if not is a file

protected isFile() : bool

Return values

bool

isPermissionCorrect()

Checks if current permission are identical to target permission

protected isPermissionCorrect() : bool

Return values

bool

isWindowsOs()

Returns TRUE if OS is windows

protected isWindowsOs() : bool

Return values

bool —

TRUE on windows

setTargetPermission()

Set target permission

protected setTargetPermission(string $permission) : mixed

Parameters

$permission : string

Permissions as a 4 character octal string, i.e. 2775 or 0644

On this page