LocalFileSystem
Filepath: phork/php/ext/files/LocalFileSystem.class.php
The LocalFileSystem class is used for all file system operations. It wraps the standard PHP filesystem functions with error handling and allows for the filesystem functions to be extended in a standardized way.
The following operations are supported
- Check if a directory exists and is a directory
- Create a directory
- Move a directory
- Delete a directory
- Change directory permissions
- List the contents of a directory
- Check if a file exists and is a file
- Open a file and return the contents
- Create a file
- Create a temp file
- Append a file
- Copy a file
- Move a file
- Delete a file
- Change the file permissions
- Check if a file or directory exists
- Return the temp directory path
- Create a hashed directory
Example
if (!($objFileSystem = AppRegistry::get('FileSystem', false))) {
if (AppLoader::includeExtension('files/', $strFileSystem = AppConfig::get('FileSystem') . 'FileSystem')) {
$objFileSystem = new $strFileSystem();
AppRegistry::register('FileSystem', $objFileSystem);
}
}
if (!$objFileSystem->isDirectory('/foo/bar')) {
$blnResult = $objFileSystem->createDirectory('/foo/bar', 0755, true);
}