Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileDownloader.php

function FileDownloader::cleanup

@inheritDoc

Overrides DownloaderInterface::cleanup

2 calls to FileDownloader::cleanup()
ArchiveDownloader::cleanup in vendor/composer/composer/src/Composer/Downloader/ArchiveDownloader.php
@inheritDoc
ArchiveDownloader::cleanup in vendor/composer/composer/src/Composer/Downloader/ArchiveDownloader.php
@inheritDoc
1 method overrides FileDownloader::cleanup()
ArchiveDownloader::cleanup in vendor/composer/composer/src/Composer/Downloader/ArchiveDownloader.php
@inheritDoc

File

vendor/composer/composer/src/Composer/Downloader/FileDownloader.php, line 315

Class

FileDownloader
Base downloader for files

Namespace

Composer\Downloader

Code

public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null) : PromiseInterface {
    $fileName = $this->getFileName($package, $path);
    if (file_exists($fileName)) {
        $this->filesystem
            ->unlink($fileName);
    }
    $dirsToCleanUp = [
        $path,
        $this->config
            ->get('vendor-dir') . '/' . explode('/', $package->getPrettyName())[0],
        $this->config
            ->get('vendor-dir') . '/composer/',
        $this->config
            ->get('vendor-dir'),
    ];
    if (isset($this->additionalCleanupPaths[$package->getName()])) {
        foreach ($this->additionalCleanupPaths[$package->getName()] as $pathToClean) {
            $this->filesystem
                ->remove($pathToClean);
        }
    }
    foreach ($dirsToCleanUp as $dir) {
        if (is_dir($dir) && $this->filesystem
            ->isDirEmpty($dir) && realpath($dir) !== Platform::getCwd()) {
            $this->filesystem
                ->removeDirectoryPhp($dir);
        }
    }
    return \React\Promise\resolve(null);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal