PHP Class Platformsh\Cli\Helper\FilesystemHelper

Inheritance: extends Symfony\Component\Console\Helper\Helper, implements Platformsh\Cli\Console\OutputAwareInterface
Mostra file Open project: commerceguys/platform-cli Class Usage Examples

Protected Properties

Property Type Description
$copyOnWindows
$fs
$relative
$shellHelper Platformsh\Cli\Helper\ShellHelperInterface

Public Methods

Method Description
__construct ( Platformsh\Cli\Helper\ShellHelperInterface $shellHelper = null, Symfony\Component\Console\Output\OutputInterface $fs = null )
archiveDir ( string $dir, string $destination ) Create a gzipped tar archive of a directory's contents.
copy ( string $source, string $destination, boolean $override = false ) Copy a file, if it is newer than the destination.
copyAll ( string $source, string $destination, array $skip = ['.git', '.DS_Store'], boolean $override = false ) Copy all files and folders between directories.
extractArchive ( string $archive, string $destination ) Extract a gzipped tar archive into the specified destination directory.
getHomeDirectory ( ) : string
getName ( )
makePathAbsolute ( string $relativePath ) : string Make a relative path into an absolute one.
makePathRelative ( string $path1, string $path2 ) : string Make a absolute path into a relative one.
mkdir ( string $dir, integer $mode = 493 )
remove ( string | array | Traversable $files, boolean $retryWithChmod = false ) : boolean Delete a file or directory.
setCopyOnWindows ( boolean $copyOnWindows = true )
setOutput ( Symfony\Component\Console\Output\OutputInterface $output )
setRelativeLinks ( boolean $relative = true ) Set whether to use relative links.
symlink ( $target, $link ) : string Create a symbolic link to a file or directory.
symlinkAll ( string $source, string $destination, boolean $skipExisting = true, boolean $recursive = false, string[] $blacklist = [], boolean $copy = false ) Symlink or copy all files and folders between two directories.

Protected Methods

Method Description
fixTarPath ( string $path ) : string Fix a path so that it can be used with tar on Windows.
getTarExecutable ( ) : string
inBlacklist ( string $filename, array $blacklist ) : boolean Check if a filename is in the blacklist.
isWindows ( ) : boolean
unprotect ( string | array | Traversable $files, boolean $recursive = false ) : boolean Make files writable by the current user.

Method Details

__construct() public method

public __construct ( Platformsh\Cli\Helper\ShellHelperInterface $shellHelper = null, Symfony\Component\Console\Output\OutputInterface $fs = null )
$shellHelper Platformsh\Cli\Helper\ShellHelperInterface
$fs Symfony\Component\Console\Output\OutputInterface

archiveDir() public method

Create a gzipped tar archive of a directory's contents.
public archiveDir ( string $dir, string $destination )
$dir string
$destination string

copy() public method

Copy a file, if it is newer than the destination.
public copy ( string $source, string $destination, boolean $override = false )
$source string
$destination string
$override boolean

copyAll() public method

Copy all files and folders between directories.
public copyAll ( string $source, string $destination, array $skip = ['.git', '.DS_Store'], boolean $override = false )
$source string
$destination string
$skip array
$override boolean

extractArchive() public method

Extract a gzipped tar archive into the specified destination directory.
public extractArchive ( string $archive, string $destination )
$archive string
$destination string

fixTarPath() protected method

Fix a path so that it can be used with tar on Windows.
See also: http://betterlogic.com/roger/2009/01/tar-woes-with-windows/
protected fixTarPath ( string $path ) : string
$path string
return string

getHomeDirectory() public static method

public static getHomeDirectory ( ) : string
return string The absolute path to the user's home directory.

getName() public method

public getName ( )

getTarExecutable() protected method

protected getTarExecutable ( ) : string
return string

inBlacklist() protected method

Check if a filename is in the blacklist.
protected inBlacklist ( string $filename, array $blacklist ) : boolean
$filename string
$blacklist array
return boolean

isWindows() protected method

protected isWindows ( ) : boolean
return boolean

makePathAbsolute() public method

The realpath() function will only work for existing files, and not for symlinks. This is a more flexible solution.
public makePathAbsolute ( string $relativePath ) : string
$relativePath string
return string

makePathRelative() public method

Make a absolute path into a relative one.
public makePathRelative ( string $path1, string $path2 ) : string
$path1 string Absolute path.
$path2 string Target path.
return string The first path, made relative to the second path.

mkdir() public method

public mkdir ( string $dir, integer $mode = 493 )
$dir string
$mode integer

remove() public method

Delete a file or directory.
public remove ( string | array | Traversable $files, boolean $retryWithChmod = false ) : boolean
$files string | array | Traversable A filename, an array of files, or a \Traversable instance to delete.
$retryWithChmod boolean Whether to retry deleting on error, after recursively changing file modes to add read/write/exec permissions. A bit like 'rm -rf'.
return boolean

setCopyOnWindows() public method

public setCopyOnWindows ( boolean $copyOnWindows = true )
$copyOnWindows boolean

setOutput() public method

public setOutput ( Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

symlinkAll() public method

Symlink or copy all files and folders between two directories.
public symlinkAll ( string $source, string $destination, boolean $skipExisting = true, boolean $recursive = false, string[] $blacklist = [], boolean $copy = false )
$source string
$destination string
$skipExisting boolean
$recursive boolean
$blacklist string[]
$copy boolean

unprotect() protected method

Make files writable by the current user.
protected unprotect ( string | array | Traversable $files, boolean $recursive = false ) : boolean
$files string | array | Traversable A filename, an array of files, or a \Traversable instance.
$recursive boolean Whether to change the mode recursively or not.
return boolean True on success, false on failure.

Property Details

$copyOnWindows protected_oe property

protected $copyOnWindows

$fs protected_oe property

protected $fs

$relative protected_oe property

protected $relative

$shellHelper protected_oe property

protected ShellHelperInterface,Platformsh\Cli\Helper $shellHelper
return Platformsh\Cli\Helper\ShellHelperInterface