class FsUtils (View source)

Methods

static A
getBackupDir(string $subdir = null)

Decide where our backup directory should go

static A
getBackupDirParent()

Get the base dir where our backup directories will be stored

static bool
isUsableDirectory(string $dir)

Description

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 protected A getBackupDirParent()

Get the base dir where our backup directories will be stored

Return Value

A path to the backup directory parent

Exceptions

Exception

static bool isUsableDirectory(string $dir)

Description

Parameters

string $dir Path to directory that we are considering using

Return Value

bool True if the specified location is writable, or if a writable directory could be created at that path.

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.