Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

$fileName)This method checks if the given filename is  '.' or '..'$fileName file (including the filename)

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

fileNameIsDot.

The call of the method above returns true.

Method nameDescriptionExample
 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

Code Block
languagephp
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

Code Block
languagephp
create('/var/www/test/');

The call of the method above create the new folder test.

fileNameIsDot
exists($dirname)
Info
titleVersion

 This method exists since CONTENIDO 4.9.7

Checks if a directory exists.

Expected parameters:

  • $dirname: the full path name of a
  • directory

Returns: bool

Code Block
languagephp
exists('
var/www/contenido/plugins');

Checks if path contenido/plugins exists: If the path exists it returns true, otherwise it returns false

fileNameIsDot($fileName)This method was moved to cFileHandler class with version 4.9.3 and is deprecated now.see  cFileHandler
isDirectoryEmpty($dir)

This method returns checks if the given directory is empty.

Expected parameters:

  • $dir: the full path name of a directory

Returns: bool

Code Block
languagephp
isDirectoryEmpty('/var/www/test');

The call of the method above returns true if the given directory exists, otherwise false.

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

Code Block
languagephp
move('/var/www/test/','/var/www/test1/');

The call of the method above grants moves the folder test to folder test1.

read($dirName, $recursive = false, $dirOnly = false, $fileOnly = 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)
  • $fileOnly(bool: list only files)

Returns: bool array (string) or boolean (false)

Code Block
languagephp
titlecDirHandler:read()
read('/var/www/test/');

The call of the method above lists the content of the folder test.

Code Block
languagephp
$sPath = $cfgClient[$client]["path"]["frontend"] . $cfgClient[$client]["upl"]["frontendpath"] . "CMS_VALUE[4]";
$aFiles = cDirHandler::read($sPath, false, false, true);

The example above returns an array containing only the files of the folder inside $sPath.

recursiveCopy($filename, $destination)  
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

Code Block
languagephp
recursiveRmdir('/var/www/test/');

The call of the method above deletes the folder test recursively.

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

Code Block
languagephp
remove('/var/www/test/');

The call of the method above deletes the folder test.

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

Code Block
languagephp
rename('/var/www/test/','/var/www/test1/');

The call of the method above renames the folder test to test1.

setDefaultDirPerms($dirname)

This method sets default permissions to the given directory

Expected parameters:

  • $pathname: the full path name of a directory

Returns: bool

Code Block
languagephp
setDefaultDirPerms('/var/www/test/');

The call of the method sets the default permissions to the the given folder.