Filesystem
Constants
CLEAN_PATH_PLUGINS_PREFIX
public const CLEAN_PATH_PLUGINS_PREFIX = "plugins"CLEAN_PATH_SRC_PREFIX
public const CLEAN_PATH_SRC_PREFIX = "pmsrc"Methods
addCleanedPath()
public static function addCleanedPath(string $path, string $replacement) : voidcleanPath()
public static function cleanPath(string $path) : stringcreateLockFile()
public static function createLockFile(string $lockFilePath) : ?intAttempts 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. If this function succeeds in gaining a lock on the file, it writes the current PID to the file.
fileGetContents()
public static function fileGetContents(string $fileName, bool $useIncludePath = false, $context = null, int $offset = 0, ?int $length = null) : stringWrapper around file_get_contents() which throws an exception instead of generating E_* errors.
getCleanedPaths()
public static function getCleanedPaths() : arrayrecursiveCopy()
public static function recursiveCopy(string $origin, string $destination) : voidRecursively copies a directory to a new location. The parent directories for the destination must exist.
recursiveUnlink()
public static function recursiveUnlink(string $dir) : voidreleaseLockFile()
public static function releaseLockFile(string $lockFilePath) : voidReleases a file lock previously acquired by createLockFile() and deletes the lock file.
safeFilePutContents()
public static function safeFilePutContents(string $fileName, string $contents, int $flags = 0, $context = null) : voidWrapper around file_put_contents() which writes to a temporary file before overwriting the original. If the disk is full, writing to the temporary file will fail before the original file is modified, leaving it untouched.
This is necessary because file_put_contents() destroys the data currently in the file if it fails to write the new contents.
