FileNode extends AbstractNode implements NodeInterface
A file
This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.
Table of Contents
Interfaces
- NodeInterface
- Interface for structure nodes root, link, file, .
Properties
- $children : array<string|int, mixed>
- $name : string
- $parent : NodeInterface|null
- $targetContent : string|null
- $targetPermission : string
Methods
- __construct() : mixed
- Implement constructor
- fix() : array<string|int, FlashMessage>
- Fix structure
- getAbsolutePath() : string
- Get absolute path of node
- getName() : string
- Get name
- getStatus() : array<string|int, 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() : array<string|int, FlashMessage>
- Fix this node: create if not there, fix permissions
- getChildren() : array<string|int, mixed>
- Get children
- getCurrentPermission() : string
- Get current permission of node
- getParent() : NodeInterface|null
- Get parent
- getRelativePathBelowSiteRoot() : string
- Cut off project path from given path
- getSelfStatus() : array<string|int, 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<string|int, mixed>
$children
= []
Directories and root may have children, files and link always empty array
$name
protected
string
$name
= ''
Name
$parent
protected
NodeInterface|null
$parent
Parent object of this structure node
$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
__construct()
Implement constructor
public
__construct(array<string|int, mixed> $structure[, NodeInterface $parent = null ]) : mixed
Parameters
- $structure : array<string|int, mixed>
-
Structure array
- $parent : NodeInterface = null
-
Parent object
Tags
fix()
Fix structure
public
fix() : array<string|int, FlashMessage>
If there is nothing to fix, returns an empty array
Return values
array<string|int, FlashMessage>getAbsolutePath()
Get absolute path of node
public
getAbsolutePath() : string
Return values
stringgetName()
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() : array<string|int, FlashMessage>
Return values
array<string|int, FlashMessage>isWritable()
Current node is writable if parent is writable
public
isWritable() : bool
Return values
bool —TRUE if parent is writable
createFile()
Create file if not exists
protected
createFile() : FlashMessage
Tags
Return values
FlashMessageexists()
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
boolfixPermission()
Fix permission if they are not equal to target permission
protected
fixPermission() : FlashMessage
Tags
Return values
FlashMessagefixSelf()
Fix this node: create if not there, fix permissions
protected
fixSelf() : array<string|int, FlashMessage>
Return values
array<string|int, FlashMessage>getChildren()
Get children
protected
getChildren() : array<string|int, mixed>
Return values
array<string|int, mixed>getCurrentPermission()
Get current permission of node
protected
getCurrentPermission() : string
Return values
string —eg. 2775 for dirs, 0664 for files
getParent()
Get parent
protected
getParent() : NodeInterface|null
Return values
NodeInterface|nullgetRelativePathBelowSiteRoot()
Cut off project path from given path
protected
getRelativePathBelowSiteRoot([string $path = null ]) : string
Parameters
- $path : string = null
-
Given path
Tags
Return values
string —Relative path, but beginning with /
getSelfStatus()
Get status of file
protected
getSelfStatus() : array<string|int, FlashMessage>
Return values
array<string|int, FlashMessage>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
Return values
bool —TRUE if current and target file content are identical
isFile()
Checks if not is a file
protected
isFile() : bool
Return values
boolisPermissionCorrect()
Checks if current permission are identical to target permission
protected
isPermissionCorrect() : bool
Return values
boolisWindowsOs()
Returns TRUE if OS is windows
protected
isWindowsOs() : bool
Return values
bool —TRUE on windows
setContent()
Sets content of file to target content
protected
setContent() : FlashMessage
Tags
Return values
FlashMessagesetTargetPermission()
Set target permission
protected
setTargetPermission(string $permission) : mixed
Parameters
- $permission : string
-
Permissions as a 4 character octal string, i.e. 2775 or 0644