DirectoryNode extends AbstractNode implements NodeInterface

A directory

Internal

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
$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 and status of child objects
isWritable()  : bool
Create a test file and delete again if directory exists
canFileBeCreated()  : bool
Create a test file and delete again - helper for isWritable
createChildren()  : mixed
Create children nodes - done in directory and root node
createDirectory()  : FlashMessage
Create directory 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 directory:
getChildren()  : array<string|int, mixed>
Get children
getChildrenStatus()  : array<string|int, FlashMessage>
Get status of 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 directory - used in root and directory node
getTargetPermission()  : string
Get target permission
isDirectory()  : bool
Checks if not is a directory
isPermissionCorrect()  : bool
Checks if current permission are identical to target permission
isWindowsOs()  : bool
Returns TRUE if OS is windows
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

$targetPermission

protected string $targetPermission = '2775'

Default for directories is octal 02775 == decimal 1533

Methods

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
string

getName()

Get name

public getName() : string
Return values
string

Name

isWritable()

Create a test file and delete again if directory exists

public isWritable() : bool
Return values
bool

TRUE if test file creation was successful

canFileBeCreated()

Create a test file and delete again - helper for isWritable

protected canFileBeCreated() : bool
Return values
bool

TRUE if test file creation was successful

createChildren()

Create children nodes - done in directory and root node

protected createChildren(array<string|int, mixed> $structure) : mixed
Parameters
$structure : array<string|int, mixed>

Array of children

Tags
throws
InvalidArgumentException

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

fixSelf()

Fix this directory:

protected fixSelf() : array<string|int, FlashMessage>
  • create with correct permissions if it was not existing
  • if there is no "write" permissions, try to fix it
  • leave it alone otherwise
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

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 /

getSelfStatus()

Get status of directory - used in root and directory node

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

isDirectory()

Checks if not is a directory

protected isDirectory() : bool
Return values
bool

True if node is a directory

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

Search results