Documentation

pm_ServerFileManager extends pm_FileManager
in package

Manager of files on server level.

Tags
since
12.5

Table of Contents

__construct()  : mixed
Creates new instance of manager
chmod()  : mixed
Changes the access permissions to file system objects (files and directories) totally are ignored on Windows
copyFile()  : mixed
Copies file system objects (files and directories) from source to destination
fileAppendContents()  : mixed
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()  : mixed
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()  : mixed
Creates a directory by path ($perms and $recursively are ignored on Windows)
moveFile()  : mixed
Moves file system objects (files and directories) from source to destination
removeDirectory()  : mixed
Removes directory by name
removeFile()  : mixed
Removes file by name
scanDir()  : array<string|int, string>
Returns list of files and directories inside the specified path
touch()  : mixed
Updates the access date and / or modification date of a file or directory.
unzip()  : mixed
Unzip user files to certain folder
upload()  : mixed
Upload file specified by source to destination ($perms are ignored on Windows)
zip()  : mixed
Zip user files

Methods

__construct()

Creates new instance of manager

public __construct([bool $privilegedUser = true ]) : mixed
Parameters
$privilegedUser : bool = true

Initialize file manager with root permissions

Tags
since
12.5
since
17.8

Has $privilegedUser parameter to be used with a non-privileged user

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) : mixed
Parameters
$filename : string
$mode : string
Tags
since
12.5
Return values
mixed

copyFile()

Copies file system objects (files and directories) from source to destination

public copyFile(string $source, string $destination) : mixed
Parameters
$source : string
$destination : string
Tags
since
17.0
Return values
mixed

fileAppendContents()

Appends a string data to a file

public fileAppendContents(string $filename, string $data) : mixed
Parameters
$filename : string
$data : string
Tags
since
18.0.39
Return values
mixed

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) : mixed
Parameters
$filename : string
$data : string
Return values
mixed

fileSize()

Returns file size in bytes

public fileSize(string $filename) : string
Parameters
$filename : string
Tags
since
12.5
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
since
17.0
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
since
17.0
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
since
17.8
Return values
bool

isSubpath()

Checks if path is inside webspace

public isSubpath(string $path) : bool
Parameters
$path : string
Tags
since
17.0
Return values
bool

joinPath()

Returns joined path parts

public joinPath(array<string|int, string> ...$pathParts) : string
Parameters
$pathParts : array<string|int, string>

Parts for joining to path

Tags
since
17.0
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 ]) : mixed
Parameters
$dirname : string
$perms : string = '0755'
$recursively : bool = false
Tags
since
12.5
Return values
mixed

moveFile()

Moves file system objects (files and directories) from source to destination

public moveFile(string $source, string $destination) : mixed
Parameters
$source : string
$destination : string
Tags
since
12.5
Return values
mixed

removeDirectory()

Removes directory by name

public removeDirectory(string $dirname) : mixed
Parameters
$dirname : string
Tags
since
12.5
Return values
mixed

removeFile()

Removes file by name

public removeFile(string $filename) : mixed
Parameters
$filename : string
Tags
since
12.5
Return values
mixed

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
since
17.0
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( $filename) : mixed
Parameters
$filename :
Tags
since
12.5
Return values
mixed

unzip()

Unzip user files to certain folder

public unzip(string $source, string $destination[, mixed $overwrite = false ]) : mixed
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
since
17.8
Return values
mixed

upload()

Upload file specified by source to destination ($perms are ignored on Windows)

public upload(string $source, string $destination[, string $perms = '0644' ]) : mixed
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
since
18.0.30
Return values
mixed

zip()

Zip user files

public zip(string $path, string $archiveName, array<string|int, mixed> $files) : mixed
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

Tags
since
17.8
Return values
mixed

Search results