PHP Класс AppserverIo\Appserver\Core\Utilities\FileSystem

Автор: Johann Zelger ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
chmod ( string $path, integer $perm ) : boolean Chmod function
chown ( string $path, integer $user, integer | null $group = null ) : boolean Chown function
cleanUpDir ( SplFileInfo $dir, boolean $alsoRemoveFiles = true ) : void Deletes all files and subdirectories from the passed directory.
copyDir ( string $src, string $dst ) : void Copies a directory recursively.
createDirectory ( string $directoryToCreate, integer $mode = 509, boolean $recursive = false ) : void Creates the passed directory.
getOsIdentifier ( ) : string Will return a three character OS identifier e.g. WIN or LIN
globDir ( string $pattern, integer $flags, boolean $recursive = true ) : array Parses and returns the directories and files that matches the passed glob pattern in a recursive way (if wanted).
initUmask ( integer $umask ) : void Init the umask to use creating files/directories, either with the passed value or the one found in the configuration.
recursiveChmod ( string $path, integer $filePerm = 420, integer $dirPerm = 493 ) : void Chmods files and folders with different permissions.
recursiveChown ( string $path, string $user, string $group = null ) : void Will set the owner and group on the passed directory.
removeDir ( string $src ) : void Removes a directory recursively.

Описание методов

chmod() публичный статический Метод

Chmod function
public static chmod ( string $path, integer $perm ) : boolean
$path string Relative or absolute path to a file or directory which should be processed.
$perm integer The permissions any file or dir should get.
Результат boolean

chown() публичный статический Метод

Chown function
public static chown ( string $path, integer $user, integer | null $group = null ) : boolean
$path string Relative or absolute path to a file or directory which should be processed.
$user integer The user that should gain owner rights.
$group integer | null The group that should gain group rights.
Результат boolean

cleanUpDir() публичный статический Метод

Deletes all files and subdirectories from the passed directory.
public static cleanUpDir ( SplFileInfo $dir, boolean $alsoRemoveFiles = true ) : void
$dir SplFileInfo The directory to remove
$alsoRemoveFiles boolean The flag for removing files also
Результат void

copyDir() публичный статический Метод

Copies a directory recursively.
public static copyDir ( string $src, string $dst ) : void
$src string The source directory to copy
$dst string The target directory
Результат void

createDirectory() публичный статический Метод

Creates the passed directory.
public static createDirectory ( string $directoryToCreate, integer $mode = 509, boolean $recursive = false ) : void
$directoryToCreate string The directory that should be created
$mode integer The mode to create the directory with
$recursive boolean TRUE if the directory has to be created recursively, else FALSE
Результат void

getOsIdentifier() публичный статический Метод

Will return a three character OS identifier e.g. WIN or LIN
public static getOsIdentifier ( ) : string
Результат string

globDir() публичный статический Метод

Parses and returns the directories and files that matches the passed glob pattern in a recursive way (if wanted).
public static globDir ( string $pattern, integer $flags, boolean $recursive = true ) : array
$pattern string The glob pattern used to parse the directories
$flags integer The flags passed to the glob function
$recursive boolean Whether or not to parse directories recursively
Результат array The directories matches the passed glob pattern

initUmask() публичный статический Метод

Init the umask to use creating files/directories, either with the passed value or the one found in the configuration.
public static initUmask ( integer $umask ) : void
$umask integer The new umask to set
Результат void

recursiveChmod() публичный статический Метод

This is an all-PHP alternative to using: \n exec("find ".$path." -type f -exec chmod 644 } \;"); \n exec("find ".$path." -type d -exec chmod 755 } \;");
public static recursiveChmod ( string $path, integer $filePerm = 420, integer $dirPerm = 493 ) : void
$path string Relative or absolute path to a file or directory which should be processed.
$filePerm integer The permissions any found files should get.
$dirPerm integer The permissions any found folder should get.
Результат void

recursiveChown() публичный статический Метод

Will set the owner and group on the passed directory.
public static recursiveChown ( string $path, string $user, string $group = null ) : void
$path string The directory to set the rights for
$user string The user to set
$group string The group to set
Результат void

removeDir() публичный статический Метод

Removes a directory recursively.
public static removeDir ( string $src ) : void
$src string The source directory to be removed
Результат void