Helper for file-related functions.

package XenForo_Helper

 Methods

Recursively creates directories until the full path is created.

createDirectory(string $path, boolean $createIndexHtml) : boolean

Parameters

$path

string

Directory path to create

$createIndexHtml

boolean

If true, creates an index.html file in the created directory

Returns

booleanTrue on success

Gets the path to the external data directory (data) This directory can NOT be moved above the web root.

getExternalDataPath() : string

Returns

stringAbsolute path

Gets a file's extension in lower case.

getFileExtension(string $filename) : string

This only includes the last extension (eg, x.tar.gz -> gz).

Parameters

$filename

string

Returns

string

Gets the path to the internal data directory (internal_data).

getInternalDataPath() : string

This directory can be moved above the web root.

Returns

stringAbsolute path

Gets the name of a temporary directory where files can be written.

getTempDir() : string

Returns

string

Method for writing out a file log.

log(string $logName, string $logEntry, boolean $append) : boolean

Parameters

$logName

string

'foo' will write to {internalDataPath}/foo.log

$logEntry

string

The string to write into the log. Line break not required.

$append

boolean

Append the log entry to the end of the existing log. Otherwise, start again.

Returns

booleanTrue on successful log write

Ensures that the specified file can be written to by the FTP user.

makeWritableByFtpUser(string $file) : boolean

This generally doesn't need to do anything if PHP is running via some form of suexec. It's primarily needed when running as apache.

Parameters

$file

string

Returns

boolean

 Properties

 

$_chmodDirectory

$_chmodDirectory 

 

$_chmodFile

$_chmodFile