// Whatever happens here, this package counts as cleaned so that we don't
// process it more than once.
$package_name =
strtolower($package->
getName());
$this->packagesAlreadyCleaned
[$package_name] = TRUE;
$package_dir =
$this->
getInstallPathForPackage($package);
if (!
is_dir($package_dir)) { return;
} $this->io->
writeError(sprintf('%sCleaning directories in <comment>%s</comment>',
str_repeat(' ', 4
),
$package_name), TRUE, IOInterface::VERY_VERBOSE
);
$fs =
new Filesystem();
foreach ($paths_for_package as $cleanup_item) { $cleanup_path =
$package_dir . '/' .
$cleanup_item;
if (!
is_dir($cleanup_path)) { // If the package has changed or the --prefer-dist version does not
// include the directory. This is not an error.
$this->io->
writeError(sprintf("%s<comment>Directory '%s' does not exist.</comment>",
str_repeat(' ', 6
),
$cleanup_path), TRUE, IOInterface::VERY_VERBOSE
);
continue;
} if (!
$fs->
removeDirectory($cleanup_path)) { // Always display a message if this fails as it means something