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

Breadcrumb

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

function Filesystem::removeEdgeCases

Return value

bool|null Returns null, when no edge case was hit. Otherwise a bool whether removal was successful

3 calls to Filesystem::removeEdgeCases()
Filesystem::removeDirectory in vendor/composer/composer/src/Composer/Util/Filesystem.php
Recursively remove a directory
Filesystem::removeDirectoryAsync in vendor/composer/composer/src/Composer/Util/Filesystem.php
Recursively remove a directory asynchronously
Filesystem::removeDirectoryPhp in vendor/composer/composer/src/Composer/Util/Filesystem.php
Recursively delete directory using PHP iterators.

File

vendor/composer/composer/src/Composer/Util/Filesystem.php, line 171

Class

Filesystem
@author Jordi Boggiano <j.boggiano@seld.be> @author Johannes M. Schmitt <schmittjoh@gmail.com>

Namespace

Composer\Util

Code

private function removeEdgeCases(string $directory, bool $fallbackToPhp = true) : ?bool {
    if ($this->isSymlinkedDirectory($directory)) {
        return $this->unlinkSymlinkedDirectory($directory);
    }
    if ($this->isJunction($directory)) {
        return $this->removeJunction($directory);
    }
    if (is_link($directory)) {
        return unlink($directory);
    }
    if (!is_dir($directory) || !file_exists($directory)) {
        return true;
    }
    if (Preg::isMatch('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
        throw new \RuntimeException('Aborting an attempted deletion of ' . $directory . ', this was probably not intended, if it is a real use case please report it.');
    }
    if (!\function_exists('proc_open') && $fallbackToPhp) {
        return $this->removeDirectoryPhp($directory);
    }
    return null;
}

API Navigation

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