Filesystem
class Filesystem extends Filesystem
File helper
Adapted from october\rain\filesystem\Filesystem
Properties
string | $filePermissions | ||
string | $folderPermissions | ||
array | $pathSymbols | ||
protected array|null | $symlinks |
Methods
Determine if the given path contains no files.
Converts a file size in bytes to human readable format.
Returns a public file path from an absolute one eg: /home/mysite/public_html/welcome -> /welcome
Returns true if the specified path is within the path of the application
Returns true if the provided disk is using the "local" driver
Finds the path to a class
Determine if a file exists with case insensitivity supported for the file only.
Normalizes the directory separator, often used by Win systems.
Converts a path using path symbol. Returns the original path if no symbol is used and no default is specified.
Returns true if the path uses a symbol.
No description
Write the contents of a file.
Copy a file to a new location.
Create a directory.
Modify file/folder permissions
Modify file/folder permissions recursively
Returns the default file permission mask to use.
Returns the default folder permission mask to use.
Match filename against a pattern.
Finds symlinks within the base path and provides a source => target array of symlinks.
Details
at line 44
bool
isDirectoryEmpty(string $directory)
Determine if the given path contains no files.
at line 69
string
sizeToString(int $bytes)
Converts a file size in bytes to human readable format.
at line 100
string
localToPublic(string $path)
Returns a public file path from an absolute one eg: /home/mysite/public_html/welcome -> /welcome
at line 138
bool
isLocalPath(string $path, bool $realpath = true)
Returns true if the specified path is within the path of the application
at line 155
bool
isLocalDisk(FilesystemAdapter $disk)
Returns true if the provided disk is using the "local" driver
at line 165
string
fromClass(mixed $className)
Finds the path to a class
at line 178
mixed
existsInsensitive(string $path)
Determine if a file exists with case insensitivity supported for the file only.
at line 205
string
normalizePath(string $path)
Normalizes the directory separator, often used by Win systems.
at line 217
string
symbolizePath(string $path, mixed $default = false)
Converts a path using path symbol. Returns the original path if no symbol is used and no default is specified.
at line 242
bool
isPathSymbol(string $path)
Returns true if the path uses a symbol.
at line 252
addPathSymbol($symbol, $path)
No description
at line 266
int
put(string $path, string $contents, $lock = false)
Write the contents of a file.
at line 280
bool
copy(string $path, string $target)
Copy a file to a new location.
at line 296
bool
makeDirectory(string $path, int $mode = 0777, bool $recursive = false, bool $force = false)
Create a directory.
at line 347
mixed
chmod(string $path, octal $mask = null)
Modify file/folder permissions
at line 369
mixed
chmodRecursive(string $path, octal $fileMask = null, octal $directoryMask = null)
Modify file/folder permissions recursively
at line 404
string
getFilePermissions()
Returns the default file permission mask to use.
at line 415
string
getFolderPermissions()
Returns the default folder permission mask to use.
at line 428
bool
fileNameMatch(string|array $fileName, string $pattern)
Match filename against a pattern.
at line 444
protected void
findSymlinks()
Finds symlinks within the base path and provides a source => target array of symlinks.