pm_FileManager
in package
Manager of hosted files for module (webspace level).
Tags
Table of Contents
- __construct() : mixed
- Creates new instance of manager
- chmod() : void
- Changes the access permissions to file system objects (files and directories) totally are ignored on Windows
- copyFile() : void
- Copies file system objects (files and directories) from source to destination
- fileAppendContents() : void
- Appends a string data to a file
- fileExists() : bool
- Checks whether a file or directory exists.
- fileGetContents() : string
- Reads entire file into a string
- filePutContents() : void
- Writes a string data to a file
- fileSize() : string
- Returns file size in bytes
- find() : array<string|int, string>
- Returns list of paths inside the specified sources that match the patterns
- getFilePath() : string
- Returns full path on filesystem by relative path inside webspace
- getRelativeFilePath() : string
- Returns relative path inside webspace by full path
- isDir() : bool
- Checks if path is directory or not.
- isSubpath() : bool
- Checks if path is inside webspace
- joinPath() : string
- Returns joined path parts
- mkdir() : void
- Creates a directory by path ($perms and $recursively are ignored on Windows)
- moveFile() : void
- Moves file system objects (files and directories) from source to destination
- removeDirectory() : void
- Removes directory by name
- removeFile() : void
- Removes file by name
- scanDir() : array<string|int, string>
- Returns list of files and directories inside the specified path
- touch() : void
- Updates the access date and / or modification date of a file or directory.
- unzip() : void
- Unzip user files to certain folder
- upload() : void
- Upload file specified by source to destination ($perms are ignored on Windows)
- zip() : void
- Zip user files
Methods
__construct()
Creates new instance of manager
public
__construct(int $domainId) : mixed
Parameters
- $domainId : int
Return values
mixed —chmod()
Changes the access permissions to file system objects (files and directories) totally are ignored on Windows
public
chmod(string $filename, string $mode) : void
Parameters
- $filename : string
- $mode : string
Tags
Return values
void —copyFile()
Copies file system objects (files and directories) from source to destination
public
copyFile(string $source, string $destination) : void
Parameters
- $source : string
- $destination : string
Tags
Return values
void —fileAppendContents()
Appends a string data to a file
public
fileAppendContents(string $filename, string $data) : void
Parameters
- $filename : string
- $data : string
Tags
Return values
void —fileExists()
Checks whether a file or directory exists.
public
fileExists(string $filename) : bool
Parameters
- $filename : string
Return values
bool —fileGetContents()
Reads entire file into a string
public
fileGetContents(string $filename) : string
Parameters
- $filename : string
Return values
string —filePutContents()
Writes a string data to a file
public
filePutContents(string $filename, string $data) : void
Parameters
- $filename : string
- $data : string
Return values
void —fileSize()
Returns file size in bytes
public
fileSize(string $filename) : string
Parameters
- $filename : string
Tags
Return values
string —find()
Returns list of paths inside the specified sources that match the patterns
public
find(array<string|int, string> $patterns[, bool $recursively = true ][, string $path = '/' ]) : array<string|int, string>
Parameters
- $patterns : array<string|int, string>
-
List of patterns, which will be searched
- $recursively : bool = true
-
[optional] Whether a recursive search should be done. Default is true
- $path : string = '/'
-
[optional] Path where search will be performed. Default is /
Tags
Return values
array<string|int, string> —List of paths
getFilePath()
Returns full path on filesystem by relative path inside webspace
public
getFilePath(string $path) : string
Parameters
- $path : string
Return values
string —getRelativeFilePath()
Returns relative path inside webspace by full path
public
getRelativeFilePath(string $path) : string
Parameters
- $path : string
Tags
Return values
string —isDir()
Checks if path is directory or not.
public
isDir(string $path) : bool
Parameters
- $path : string
-
Path to file or directory
Tags
Return values
bool —isSubpath()
Checks if path is inside webspace
public
isSubpath(string $path) : bool
Parameters
- $path : string
Tags
Return values
bool —joinPath()
Returns joined path parts
public
joinPath(string|array<string|int, string> ...$pathParts) : string
Parameters
- $pathParts : string|array<string|int, string>
-
Parts for joining to path
Tags
Return values
string —mkdir()
Creates a directory by path ($perms and $recursively are ignored on Windows)
public
mkdir(string $dirname[, string $perms = '0755' ][, bool $recursively = false ]) : void
Parameters
- $dirname : string
- $perms : string = '0755'
- $recursively : bool = false
Tags
Return values
void —moveFile()
Moves file system objects (files and directories) from source to destination
public
moveFile(string $source, string $destination) : void
Parameters
- $source : string
- $destination : string
Tags
Return values
void —removeDirectory()
Removes directory by name
public
removeDirectory(string $dirname) : void
Parameters
- $dirname : string
Tags
Return values
void —removeFile()
Removes file by name
public
removeFile(string $filename) : void
Parameters
- $filename : string
Tags
Return values
void —scanDir()
Returns list of files and directories inside the specified path
public
scanDir(string $path[, bool $skipDots = false ][, bool $showSystemFiles = true ]) : array<string|int, string>
Parameters
- $path : string
- $skipDots : bool = false
- $showSystemFiles : bool = true
Tags
Return values
array<string|int, string> —List of file names
touch()
Updates the access date and / or modification date of a file or directory.
public
touch(string $filename) : void
Parameters
- $filename : string
Tags
Return values
void —unzip()
Unzip user files to certain folder
public
unzip(string $source, string $destination[, mixed $overwrite = false ]) : void
Parameters
- $source : string
-
Path, where packed archive is hosted.
- $destination : string
-
Path, where you want to put files from packed archive
- $overwrite : mixed = false
Tags
Return values
void —upload()
Upload file specified by source to destination ($perms are ignored on Windows)
public
upload(string $source, string $destination[, string $perms = '0644' ]) : void
Parameters
- $source : string
-
Path where file is located
- $destination : string
-
Path where file is to be uploaded
- $perms : string = '0644'
-
[optional] Permissions of the uploaded file. Ignored on Windows. Default is 0644
Tags
Return values
void —zip()
Zip user files
public
zip(string $path, string $archiveName, array<string|int, mixed> $files) : void
Parameters
- $path : string
-
Path, where you want to put new archive
- $archiveName : string
-
Name for your archive
- $files : array<string|int, mixed>
-
Array of files paths, which will be included to your archive