ClearFoundation

ClearOS API

Class Folder

Description

Folder handling class.

The Folder class can be used for creating, reading and manipulating folders (directories) on the filesystem.

  • author: Point Clark Networks
  • copyright: Copyright 2006, Point Clark Networks
  • license: GNU

Located in /api/Folder.class.php (line 161)

Engine
   |
   --Folder
Class Constant Summary
 CMD_CHMOD = '/bin/chmod'
 CMD_CHOWN = '/bin/chown'
 CMD_DU = '/usr/bin/du'
 CMD_FILE = '/usr/bin/file'
 CMD_FIND = '/usr/bin/find'
 CMD_LS = '/bin/ls'
 CMD_MKDIR = '/bin/mkdir'
 CMD_REALPATH = '/usr/sbin/app-realpath'
 CMD_RM = '/bin/rm'
 CMD_RMDIR = '/bin/rmdir'
Variable Summary
string $folder
boolean $superuser
Method Summary
void Chmod (string $mode)
void Chown (string $owner, string $group, [string $recursive = false])
Folder __construct ( $folder, [string $superuser = false])
void Create (string $owner, string $group, string $mode)
void Delete ([bool $ignore_nonempty = false])
boolean Exists ()
string GetFoldername ()
array GetListing ([boolean $detailed = false])
string GetPermissions ()
integer GetSize ()
boolean IsDirectory ()
Variables
string $folder = null (line 186)
  • var: folder
  • access: protected
boolean $superuser = false (line 192)
  • var: superuser
  • access: protected

Inherited Variables

Inherited from Engine

Engine::$errors
Methods
Chmod (line 227)

Changes the folder mode.

Use the standard command-line chmod values.

void Chmod (string $mode)
  • string $mode: the mode of the folder
Chown (line 258)

Changes the owner and/or group.

Leave the owner or group blank if you do not want change one or the other.

void Chown (string $owner, string $group, [string $recursive = false])
  • string $owner: folder owner
  • string $group: folder group
  • string $recursive: do chown recursively
Constructor __construct (line 205)

Folder constructor.

Folder __construct ( $folder, [string $superuser = false])
  • string $superuser: folder target folder
  • $folder

Redefinition of:
Engine::__construct()
Engine constructor.
Create (line 311)

Creates a folder on the system.

The method will return an error if the file already exists.

void Create (string $owner, string $group, string $mode)
  • string $owner: folder owner
  • string $group: folder group
  • string $mode: the mode of the folder
Delete (line 354)

Deletes the folder.

void Delete ([bool $ignore_nonempty = false])
  • bool $ignore_nonempty: flag to ignore (use rm -rf) if files are contained within folder
Exists (line 414)

Checks the existence of the folder.

  • return: true if folder exists
boolean Exists ()
GetFoldername (line 620)

Returns the foldername (using PHP 'realpath') resolving references like "".

  • return: name of present working directory
string GetFoldername ()
GetListing (line 446)

Returns the listing of files in the directory.

The current (.) and and parent (..) entries are not included.

  • return: file listing
array GetListing ([boolean $detailed = false])
  • boolean $detailed: if true, array contains detailed informatio about diredtory
GetPermissions (line 527)

Returns the octal permissions of the current folder.

  • return: folder permissions
  • throws: FolderNotFoundException, EngineException
string GetPermissions ()
GetRecursiveListing (line 551)

Returns the listing of files in the directory.

The current (.) and and parent (..) entries are not included.

  • return: file listing
array GetRecursiveListing ()
GetSize (line 586)

Returns an estimate of the size of the contents of the folder.

  • return: the folder size in bytes
  • throws: FileException
integer GetSize ()
IsDirectory (line 388)

Checks to see if given folder is really a folder.

  • return: true if directory
boolean IsDirectory ()

Inherited Methods

Inherited From Engine

Engine::__construct()
Engine::AddValidationError()
Engine::CheckValidationErrors()
Engine::CopyValidationErrors()
Engine::GetValidationErrors()
Engine::Log()
Engine::__destruct()
Class Constants
CMD_CHMOD = '/bin/chmod' (line 171)
CMD_CHOWN = '/bin/chown' (line 170)
CMD_DU = '/usr/bin/du' (line 168)
CMD_FILE = '/usr/bin/file' (line 172)
CMD_FIND = '/usr/bin/find' (line 175)
CMD_LS = '/bin/ls' (line 167)
CMD_MKDIR = '/bin/mkdir' (line 169)
CMD_REALPATH = '/usr/sbin/app-realpath' (line 176)
CMD_RM = '/bin/rm' (line 174)
CMD_RMDIR = '/bin/rmdir' (line 173)

Inherited Constants

Inherited from Engine

Engine::COMMAND_API

Documentation generated on Fri, 28 Aug 2009 20:32:10 -0400 by phpDocumentor 1.3.2