PHP Class VersionPress\Utils\FileSystem

Exibir arquivo Open project: versionpress/versionpress Class Usage Examples

Public Methods

Method Description
copy ( string $origin, string $target, boolean $override = false ) Copies a file. Uses Symfony's copy but actually honors the third parameter.
copyDir ( string $origin, string $target ) Copies a directory. Uses Symfony's mirror() under the cover.
filesHaveSameContents ( $file1, $file2 ) : boolean Compares two files and returns true if their contents is equal
mkdir ( string $dir, integer $mode = 488 ) Creates a directory
remove ( string | Traversabl\Traversable $path ) Removes a file / directory. Works recursively.
removeContent ( string $path ) Removes the content of a directory (not the directory itself). Works recursively.
rename ( string $origin, string $target, boolean $overwrite = false ) Renames (moves) origin to target.

Private Methods

Method Description
possiblyFixGitPermissions ( string $path ) Git for Windows makes files in .git/objects read-only. This method removes the flag so that operations like removing the folder work.

Method Details

copy() public static method

Copies a file. Uses Symfony's copy but actually honors the third parameter.
public static copy ( string $origin, string $target, boolean $override = false )
$origin string
$target string
$override boolean

copyDir() public static method

Copies a directory. Uses Symfony's mirror() under the cover.
See also: Symfony\Component\Filesystem\Filesystem::mirror()
public static copyDir ( string $origin, string $target )
$origin string
$target string

filesHaveSameContents() public static method

Compares two files and returns true if their contents is equal
public static filesHaveSameContents ( $file1, $file2 ) : boolean
$file1
$file2
return boolean

mkdir() public static method

Creates a directory
public static mkdir ( string $dir, integer $mode = 488 )
$dir string
$mode integer

remove() public static method

Removes a file / directory. Works recursively.
See also: Symfony\Component\Filesystem\Filesystem::remove()
public static remove ( string | Traversabl\Traversable $path )
$path string | Traversabl\Traversable Path to a file or directory.

removeContent() public static method

Removes the content of a directory (not the directory itself). Works recursively.
public static removeContent ( string $path )
$path string Path to a directory.

rename() public static method

Renames (moves) origin to target.
See also: Symfony\Component\Filesystem\Filesystem::rename()
public static rename ( string $origin, string $target, boolean $overwrite = false )
$origin string
$target string
$overwrite boolean