class FsUtils (View source)

Methods

static A
getBackupDir(string $subdir = null)

Decide where our backup directory should go

static string
prepareBackupDir(string $subdir = null)

Prepare a backup directory.

static string
realpath(string $path)

Returns canonicalized absolute pathname.

static string|bool
isTarball(string $path)

Check whether a file is a supported tarball.

static string|bool|null
getMimeContentType(string $path)

Determines the MIME content type of the specified file.

Details

static A getBackupDir(string $subdir = null)

Decide where our backup directory should go

Parameters

string $subdir The name of the desired subdirectory(s) under drush-backups. Usually a database name.

Return Value

A path to the backup directory.

Exceptions

Exception

static string prepareBackupDir(string $subdir = null)

Prepare a backup directory.

Parameters

string $subdir A string naming the subdirectory of the backup directory.

Return Value

string Path to the specified backup directory.

Exceptions

Exception

static string realpath(string $path)

Returns canonicalized absolute pathname.

The difference between this and PHP's realpath() is that this will return the original path even if it doesn't exist.

Parameters

string $path The path being checked.

Return Value

string The canonicalized absolute pathname.

static string|bool isTarball(string $path)

Check whether a file is a supported tarball.

Parameters

string $path

Return Value

string|bool The file content type if it's a tarball. FALSE otherwise.

static string|bool|null getMimeContentType(string $path)

Determines the MIME content type of the specified file.

The power of this function depends on whether the PHP installation has either mime_content_type() or finfo installed -- if not, only tar, gz, zip and bzip2 types can be detected.

Parameters

string $path

Return Value

string|bool|null The MIME content type of the file.