FS
abstract
FS
FTPFS

An abstract class for writing to the filesystem.  We use this to access the concrete subclasses for native filesystem and FTP access.  Maybe one day there will be some other useful method for filesystem access....

Functions
getcwd
public abstract function getcwd()

Get the working directory for the class.

Returns; A string with the working directory reported by the filesystem functions.

getcwdLocal
public function getcwdLocal()

Wrapper around native getcwd() function.  This is always the local current directory, regardless of the filesystem driver.

chdir
public abstract function chdir(
$dir
)

Change working directory

Parameters
dir

A standard local path to the new directory.

Returns

True on success, false on failure.

mkdir
public abstract function mkdir(
$dir,
$mode0777
)

Create a new directory.  For this function, the immediate parent directory must exist

Paremeters
dir

The local path to the new directory.

mode

An optional umask for file permissions on the new directory.

Returns

False on failure, an unspecified non-false value on success.

mkdir_rec
public abstract function mkdir_rec(
$dir,
$mode0777
)

Recursive version of mkdir.  This will create all non-existent parents of the target path.

Parameters
dir

The local path to the new directory.

mode

An optional umask for file permissions on the new directory.

Retruns

False on failure, a non-false value on success.

rmdir
public abstract function rmdir(
$dir
)

Remove an empty directory.

Parameters
dir

The local path of the directory to remove.

Returns

True on success, false on failure.

rmdir
public abstract function rmdir_rec(
$dir
)

Recursive version of rmdir.  Remove a directory and all files and directories it contains.

Parameters
dir

The local path of the directory to remove.

Returns

True on success, false on failure.

chmod
public abstract function chmod(
$path,
$mode
)

Change permissions on a file or directory.

Parameters
path

The local path to the file to change.

mode

The UNIX octal value to set the permissions to.

Returns

False on failure, an unspecified non-false value on success.

directoryMode
public function directoryMode(
$modefalse
)

Gets and sets the permissions to use when creating directories.

Parameters
mode

The optional octal permissions to use.

Returns

The octal UNIX permissions used when creating directories.

scriptMode
public function scriptMode(
$modefalse
)

Gets and sets the

Parameters
mode

The optional octal permissions to use.

Returns

The octal UNIX permissions used when creating PHP scripts.

defaultMode
public function defaultMode(
$modefalse
)

Gets and sets the permissions to use for other files, i.e. not directories or PHP scripts

Parameters
mode

The optional octal permissions to use.

Returns

The octal UNIX permissions used when creating other files.

isScript
public function isScript(
$path
)

Determines if a given path represents a PHP script or not.

Parameters
path

the path of the file in question.

Returns

True if the file uses a known extension for PHP scripts, false otherwise.  Currently, known extensions are of the form .phpX where X is empty or a number.

copy
public abstract function copy(
$src,
$dest
)

Copy a single file.

Parameters
src

The local path to the file to copy

dest

The path to copy it to.

Returns

True on success, false on failure.

rename
public abstract function rename(
$src,
$dest
)

Move or rename a file.

Parameters
src

The local path to the file to move or rename.

dest

The new file path.

Returns

True on success, false on failure.

delete
public abstract function delete(
$src
)

Delete a single file.

Parameters
src

The local path to the file to delete.

Returns

True on success, false on failure.

write_file
public abstract function write_file(
$path,
$contents
)

Write a string to a new text file.

Parameters
path

The local path to the file.

contents

A string containing te desired contents of the file.

Returns

False on failure, an unspecified non-false value on success.

copy_rec
public function copy_rec(
$src,
$dest
)

Recursively copy a directory.  If called on a file, it will just copy the file.

Parameters
src

The source directory to copy

dest

The destination directory

Returns

True on success, false if any part of the operation (file copy or directory creation) fails.

read_file
public function read_file(
$path
)

Read a file from disk.

Parameters
path

The path to the file to read.

Returns

The file contents as a string, or calse on failure.

readfile
public function readfile(
$path
)

Wrapper around native readfile() function.

echo_to_string

Wrapper around the native echo statement.

is_dir
public function is_dir(
$path
)

Wrapper around native is_dir() function.

is_file
public function is_file(
$path
)

Wrapper around native is_file() method

is_uploaded_file
public function is_uploaded_file(
$path
)

Wrapper around native is_uploaded_file() function.

file_exists
public function file_exists(
$path
)

Wrapper around native file_exists() function.

scandir
public function scandir(
$directory,
$sorting_order SCANDIR_SORT_ASCENDING
)

Wraper around native scandir() function.

scan_directory
public function scan_directory(
$path,
$dirs_onlyfalse
)

Does essentially the same thing as scandir on PHP 5.  Gets all the entries in the given directory.

Parameters
path

The directory path to scan.

dirs_only

Optional parameter to list only the directories in the path.  The default is false.

Returns

An array of directory entry names, removing "." and ".." entries.

glob
public function glob(
$expression,
$flags 0
)

Does a shell wildcard glob and returns the results.

Parameters

expression = (string) The wildcard pattern to match.  flags - (int) A bitmask of flags to manipulate the glob behavior.

Returns

An array containing the list of matched files and/or directories.

filesize
public function filesize(
$path
)

Wrapper around native filesize() function.

filemtime
public function filemtime(
$path
)

Wrapper around native filemtime function.

file
public function file(
$path
)

Wrapper around native file function.

realpath
public function realpath(
$path
)

Wrapper around native realpath function.

is_link
public function is_link(
$path
)

Wrapper around native is_link function.

symlink
public function symlink(
$src,
$dest
)

Wrapper around native symlink function.