Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The cDirHandler class encapsules functionalities for dealing with directories.

Methods:

All provided functionalities are in a public static context.

 

methodNameDescriptionExample
 chmod($dirname, $mode)

This method can be used to change directory permissions on a *nix system.

Expected parameters:

  • $dirname: the full path name of a directory
  • $mode: permission you want to set in octal mode

Returns: bool

chmod('/var/www/test/,777);

The call of the method above grants read, write and execute rights.

 create($pathname, $recursive = false)

This method can be used to create a new folder.

Expected parameters:

  • $dirname: the full path name of a directory

Optional parameters:

  • $recursive

Returns: bool

 
fileNameIsDot($fileName)

This method checks if the given filename is  '.' or '..'.

Expected parameters:

  • $fileName: the full path name of a file (including the filename)

Returns: bool

In my opinion this method should be transfered to the cFileHandler class, highly recommended!

 
move($dirname, $destination)

This method can be used to move a folder to another location.

Expected parameters:

  • $dirname: the full path name of a directory
  • destination: the full path of the new location

Returns: bool

 
read($dirName, $recursive = false, $dirOnly = false)

This method reads the content from given directory.

Expected parameters:

  • $dirName: the full path name of a directory

Optional parameters:

  • $recursive(bool: list recursive)
  • $dirOnly(bool: list only directories)

Returns: bool

 
 recursiveRmdir($dirname)

This method deletes the given folder recursively, that means including all of its subfolders and files.

Expected parameters:

  • $dirname: the full directory path

Returns: bool

 

remove($dirname)

This method removes the given directory from the filesystem.

Expected parameters:

  • $filename: the full path name of a file (including the filename)

Returns: bool

 


 

rename($dirname, $new_dirname)

This method renames the given file from the filesystem.

Expected parameters:

  • $filename: the full path name of a file (including the filename)
  • $new_filename: the full path name of a file (including the filename)

Returns: bool

 
setDefaultDirPerms($dirname)

This method sets default permissions to the given directory

Expected parameters:

  • $pathname: the full path name of a directory

Returns: bool

 
  • No labels