The cFileHandler class encapsules functionalities for dealing with files.
Methods:
All provided functionalities are in a public static context.
methodName | Description | Example | |||||||
---|---|---|---|---|---|---|---|---|---|
chmod($filename, $mode) | This function method can be used to change file permissions on a *nix system. Expected parameters:
|
The call of the method above grants read, write and execute rights. | |||||||
copy($filename, $destination) | This function method copies a file to a given location. Existing files will be overwritten Expected parameters:
Returns: bool |
The call of the method above copies the index.php file to the index2.php file. | |||||||
exists($filename) | This function method checks if a file exists at the given location Expected parameters:
Returns: bool |
The call of the method above returns true if the 'var/www/index.php' file exists overwise false. , otherwise false. | |||||||
fileNameIsDot($fileName) | This method checks if the given filename is '.' or '..'. Expected parameters:
Returns: bool |
The call of the method above returns true. | |||||||
getExtension($basename) | This function method returns the file extension of the given file Expected parameters:
Returns: string |
The call of the method above returns the string 'php'. | |||||||
info($filename) | This method returns information about the given file. The returing array includes the following information:
Expected parameters:
Returns: array | ||||||||
isDirectoryEmpty($dir) | This method was moved to cDirHandler class with version 4.9.3 and is deprecated now. | see cDirHandler | |||||||
move($filename, $destination) | This method changes the location of the given file Expected parameters:
Returns: bool |
The call of the method above moves the index.php file from path '/var/www/' to '/var/www/test/'.
| |||||||
read($filename, $length = 0, $offset = 0, $reverse = false) | This method reads bytes from the given file. Expected parameters:
Optional parameters:
Returns: bool |
The call of the method above returns the content of the index.php file. | |||||||
readable($filename) | This method checks if the given file is readable. Expected parameters:
Returns: bool |
The call of the method above moves returns true if the index.php file is readable, otherwise false. | |||||||
readLine($filename, $lines = 0, $lineoffset = 0) | This method reads a line from the given file. Expected parameters:
Optional parameters:
Returns:
|
The call of the method above returns the first line of the content from the index.php file. | |||||||
recursiveCopy($filename, $destination) | This method was moved to cDirHandler class with version 4.9.3 and is deprecated now. | see cDirHandler | |||||||
recursiveRmdir($dirname) | This method was moved to cDirHandler class with version 4.9.3 and is deprecated now. | see cDirHandler | |||||||
remove($filename) | This method removes the given file from the filesystem. Expected parameters:
Returns: bool |
The call of the method above removes the index.php file.
| |||||||
rename($filename, $new_filename) | This method renames the given file from the filesystem. Expected parameters:
Returns: bool |
The call of the method above renames the index.php file to index.html. | |||||||
setDefaultDirPerms($pathname) | This method was moved to cDirHandler class with version 4.9.3 and is deprecated now. | see cDirHandler | |||||||
setDefaultFilePerms($filename) | This method sets default permissions to the given file Expected parameters:
Returns: bool | ||||||||
truncate($filename) | This method clears the content of the given file Expected parameters:
Returns: bool |
The call of the method above removes the content of the index.php file. | |||||||
validateFilename($filename, $notifyAndExitOnFailure = true) | This method validates the filename of the given file with CONENTIDO standard. Expected parameters:
Optional parameters:
Returns: bool | ||||||||
write($filename, $content, $append = false) | This method writes data to the given file Expected parameters:
Optional parameters:
Returns: bool |
The call of the method above writes the string 'hello world!' in the index.php file. | |||||||
writeable($filename) | This method checks if the given file is writeable Expected parameters:
Returns: bool |
The call of the method above returns true if the index.php file is writeable, otherwise false. | |||||||
writeLine($filename, $content, $append = false) | This method writes a line to the given file Expected parameters:
Optional parameters:
Returns: bool |
The call of the method above returns writes the line 'hello world!' to the index.php file. |