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
An abstract class for writing to the filesystem.
An explicitly called destructor because PHP 4 doesn’t have proper destructors.
Get the working directory for the class.
Change working directory
Create a new directory.
Recursive version of mkdir.
Remove an empty directory.
Recursive version of rmdir.
Change permissions on a file or directory.
Copy a single file.
Move or rename a file.
Delete a single file.
Write a string to a new text file.

Functions

destruct

function destruct()

An explicitly called destructor because PHP 4 doesn’t have proper destructors.  Releases all resources the object is holding.

getcwd

function getcwd()

Get the working directory for the class.

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

chdir

function chdir($dir)

Change working directory

Parameters

dirA standard local path to the new directory.

Returns

True on success, false on failure.

mkdir

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

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

function rmdir($dir)

Remove an empty directory.

Parameters

dirThe local path of the directory to remove.

Returns

True on success, false on failure.

rmdir

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

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.

copy

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

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

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

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.

function destruct()
An explicitly called destructor because PHP 4 doesn’t have proper destructors.
function getcwd()
Get the working directory for the class.
function chdir($dir)
Change working directory
function mkdir($dir,  
$mode = 0777)
Create a new directory.
function mkdir_rec($dir,  
$mode = 0777)
Recursive version of mkdir.
function rmdir($dir)
Remove an empty directory.
function chmod($path,
$mode)
Change permissions on a file or directory.
function copy($src,
$dest)
Copy a single file.
function rename($src,
$dest)
Move or rename a file.
function delete($src)
Delete a single file.
function write_file($path,
$contents)
Write a string to a new text file.