175 $this->currentMapping = $mapping;
207 $destination =
'/'.$destination;
208 $destination = str_replace(
'/./',
'/', $destination);
209 $destination = str_replace(
'//',
'/', $destination);
210 foreach($this->ignoredMappings as $ignored){
211 if( 0 === strpos($ignored,$destination) ){
223 $this->mappings[] = array($key,
$value);
228 return rtrim(
$path,
' \\/');
248 $destPath = $this->
getDestDir() .
'/' . $dest;
273 if (! file_exists($destPath) && in_array(substr($destPath, -1), array(
'/',
'\\')) && !
is_dir($sourcePath)) {
274 mkdir($destPath, 0777,
true);
279 if (!file_exists($sourcePath)) {
281 $matches = glob($sourcePath);
283 foreach ($matches as $match) {
284 $newDest = substr($destPath .
'/' . basename($match), strlen($this->
getDestDir()));
285 $newDest = ltrim($newDest,
' \\/');
292 throw new \ErrorException(
"Source $sourcePath does not exist");
307 $destPath = $this->
getDestDir() .
'/' . $dest;
310 if (!file_exists($sourcePath)) {
313 }
elseif (file_exists($sourcePath) &&
is_dir($sourcePath)) {
321 if (basename($sourcePath) !== basename($destPath)) {
322 $destPath .=
'/' . basename(
$source);
336 $sourcePath = preg_replace(
'#/\*$#',
'/{,.}*', $sourcePath);
337 $matches = glob($sourcePath, GLOB_BRACE);
339 foreach ($matches as $match) {
340 if (preg_match(
"#/\.{1,2}$#", $match)) {
343 $newDest = substr($destPath .
'/' . basename($match), strlen($this->
getDestDir()));
344 $newDest = ltrim($newDest,
' \\/');
345 $this->
remove(substr($match, strlen($this->
getSourceDir())+1), $newDest);
351 throw new \ErrorException(
"Source $sourcePath does not exist");
362 $absoluteDir = $this->
getDestDir() .
'/' . $dir;
363 if (
is_dir($absoluteDir)) {
364 $iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($absoluteDir),
365 \RecursiveIteratorIterator::CHILD_FIRST);
369 if (!strcmp(
$path,
'.') || !strcmp(
$path,
'..')) {
381 if (@
rmdir($absoluteDir)) {
383 $parentDir = dirname($dir);
384 $absoluteParentDir = $this->
getDestDir() .
'/' . $parentDir;
385 if (! isset($stopDir) || (realpath($stopDir) !== realpath($absoluteParentDir))) {
400 $fs = new \Composer\Util\Filesystem();
402 $result = $fs->removeDirectory($dir);
elseif(isset( $params[ 'redirect_parent']))
createDelegate($source, $dest)
setIsForced($forced=true)
removeContentOfCategory($sourcePath, $destPath)
setIgnoredMappings($ignoredMappings)
setCurrentMapping($mapping)
rmEmptyDirsRecursive($dir, $stopDir=null)
removeTrailingSlash($path)
static rmdirRecursive($dir)
mkdir($pathname, $mode=0777, $recursive=false, $context=null)
setMappings(array $mappings)
isDestinationIgnored($destination)
__construct($sourceDir, $destDir)