Documentation

Filesystem
in package

Table of Contents

CLEAN_PATH_PLUGINS_PREFIX  = "plugins"
CLEAN_PATH_SRC_PREFIX  = "pmsrc"
$cleanedPaths  : array<string|int, string>
$lockFileHandles  : array<string|int, resource>
addCleanedPath()  : void
cleanPath()  : string
createLockFile()  : int|null
Attempts to get a lock on the specified file, creating it if it does not exist. This is typically used for IPC to inform other processes that some file or folder is already in use, to avoid data corruption.
getCleanedPaths()  : array<string|int, string>
recursiveCopy()  : void
Recursively copies a directory to a new location. The parent directories for the destination must exist.
recursiveUnlink()  : void
releaseLockFile()  : void
Releases a file lock previously acquired by createLockFile() and deletes the lock file.
__construct()  : mixed
recursiveCopyInternal()  : void

Constants

CLEAN_PATH_PLUGINS_PREFIX

public mixed CLEAN_PATH_PLUGINS_PREFIX = "plugins"

CLEAN_PATH_SRC_PREFIX

public mixed CLEAN_PATH_SRC_PREFIX = "pmsrc"

Properties

$cleanedPaths

private static array<string|int, string> $cleanedPaths = [\pocketmine\PATH => self::CLEAN_PATH_SRC_PREFIX]
Tags
phpstan-var

array<string, string>

$lockFileHandles

private static array<string|int, resource> $lockFileHandles = []

Methods

addCleanedPath()

public static addCleanedPath(string $path, string $replacement) : void
Parameters
$path : string
$replacement : string
Return values
void

cleanPath()

public static cleanPath(string $path) : string
Parameters
$path : string
Return values
string

createLockFile()

Attempts to get a lock on the specified file, creating it if it does not exist. This is typically used for IPC to inform other processes that some file or folder is already in use, to avoid data corruption.

public static createLockFile(string $lockFilePath) : int|null

If this function succeeds in gaining a lock on the file, it writes the current PID to the file.

Parameters
$lockFilePath : string
Tags
throws
InvalidArgumentException

if the lock file path is invalid (e.g. parent directory doesn't exist, permission denied)

Return values
int|null

process ID of the process currently holding the lock failure, null on success.

getCleanedPaths()

public static getCleanedPaths() : array<string|int, string>
Tags
phpstan-return

array<string, string>

Return values
array<string|int, string>

recursiveCopy()

Recursively copies a directory to a new location. The parent directories for the destination must exist.

public static recursiveCopy(string $origin, string $destination) : void
Parameters
$origin : string
$destination : string
Return values
void
public static recursiveUnlink(string $dir) : void
Parameters
$dir : string
Return values
void

releaseLockFile()

Releases a file lock previously acquired by createLockFile() and deletes the lock file.

public static releaseLockFile(string $lockFilePath) : void
Parameters
$lockFilePath : string
Tags
throws
InvalidArgumentException

if the lock file path is invalid (e.g. parent directory doesn't exist, permission denied)

Return values
void

__construct()

private __construct() : mixed
Return values
mixed

recursiveCopyInternal()

private static recursiveCopyInternal(string $origin, string $destination) : void
Parameters
$origin : string
$destination : string
Return values
void

Search results