FS

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....

Summary
FSAn abstract class for writing to the filesystem.
Functions
getcwdGet the working directory for the class.
chdirChange working directory
mkdirCreate a new directory.
mkdir_recRecursive version of mkdir.
rmdirRemove an empty directory.
rmdirRecursive version of rmdir.
chmodChange permissions on a file or directory.
directoryModeGets and sets the permissions to use when creating directories.
scriptModeGets and sets the
defaultModeGets and sets the permissions to use for other files, i.e.
isScriptDetermines if a given path represents a PHP script or not.
copyCopy a single file.
renameMove or rename a file.
deleteDelete a single file.
write_fileWrite a string to a new text file.

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.

chdir

public abstract function chdir($dir)

Change working directory

Parameters

dirA standard local path to the new directory.

Returns

True on success, false on failure.

mkdir

public abstract function mkdir($dir,  
$mode = 0777)

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

Paremeters

dirThe local path to the new directory.
modeAn 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,  
$mode = 0777)

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

Parameters

dirThe local path to the new directory.
modeAn 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

dirThe 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

dirThe 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

pathThe local path to the file to change.
modeThe UNIX octal value to set the permissions to.

Returns

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

directoryMode

public function directoryMode($mode = false)

Gets and sets the permissions to use when creating directories.

Parameters

modeThe optional octal permissions to use.

Returns

The octal UNIX permissions used when creating directories.

scriptMode

public function scriptMode($mode = false)

Gets and sets the

Parameters

modeThe optional octal permissions to use.

Returns

The octal UNIX permissions used when creating PHP scripts.

defaultMode

public function defaultMode($mode = false)

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

Parameters

modeThe 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

paththe 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

srcThe local path to the file to copy
destThe 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

srcThe local path to the file to move or rename.
destThe new file path.

Returns

True on success, false on failure.

delete

public abstract function delete($src)

Delete a single file.

Parameters

srcThe 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

pathThe local path to the file.
contentsA string containing te desired contents of the file.

Returns

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

public abstract function getcwd()
Get the working directory for the class.
public abstract function chdir($dir)
Change working directory
public abstract function mkdir($dir,  
$mode = 0777)
Create a new directory.
public abstract function mkdir_rec($dir,  
$mode = 0777)
Recursive version of mkdir.
public abstract function rmdir($dir)
Remove an empty directory.
public abstract function chmod($path,
$mode)
Change permissions on a file or directory.
public function directoryMode($mode = false)
Gets and sets the permissions to use when creating directories.
public function scriptMode($mode = false)
Gets and sets the
public function defaultMode($mode = false)
Gets and sets the permissions to use for other files, i.e.
public function isScript($path)
Determines if a given path represents a PHP script or not.
public abstract function copy($src,
$dest)
Copy a single file.
public abstract function rename($src,
$dest)
Move or rename a file.
public abstract function delete($src)
Delete a single file.
public abstract function write_file($path,
$contents)
Write a string to a new text file.
Close